Loading...
Searching...
No Matches
type_list
// vi:set ft=cpp: -*- Mode: C++ -*-
#pragma once
/*
* (c) 2012 Alexander Warg <warg@os.inf.tu-dresden.de>,
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#include "type_traits"
namespace cxx {
template< typename ...T >
struct type_list;
template<>
struct type_list<>
{
typedef false_type head;
typedef false_type tail;
};
template<typename HEAD, typename ...TAIL>
struct type_list<HEAD, TAIL...>
{
typedef HEAD head;
typedef type_list<TAIL...> tail;
};
template<typename TYPELIST, template <typename T> class PREDICATE>
struct find_type;
template<template <typename T> class PREDICATE>
struct find_type<type_list<>, PREDICATE>
{
typedef false_type type;
};
template<typename TYPELIST, template <typename T> class PREDICATE>
struct find_type
{
typedef typename conditional<PREDICATE<typename TYPELIST::head>::value,
typename TYPELIST::head,
typename find_type<typename TYPELIST::tail, PREDICATE>::type>::type type;
};
template<typename TYPELIST, template <typename T> class PREDICATE>
using find_type_t = typename find_type<TYPELIST, PREDICATE>::type;
}
cxx
Our C++ library.
Definition arith:11