5 * (c) 2012 Alexander Warg <warg@os.inf.tu-dresden.de>,
6 * economic rights: Technische Universität Dresden (Germany)
8 * This file is part of TUD:OS and distributed under the terms of the
9 * GNU General Public License 2.
10 * Please see the COPYING-GPL-2 file for details.
12 * As a special exception, you may use this file as part of a free software
13 * library without restriction. Specifically, if other files instantiate
14 * templates or use macros or inline functions from this file, or you compile
15 * this file and link it with other files to produce an executable, this
16 * file does not by itself cause the resulting executable to be covered by
17 * the GNU General Public License. This exception does not however
18 * invalidate any other reasons why the executable file might be covered by
19 * the GNU General Public License.
23 #include "type_traits"
27 template< typename ...T >
33 typedef false_type head;
34 typedef false_type tail;
37 template<typename HEAD, typename ...TAIL>
38 struct type_list<HEAD, TAIL...>
41 typedef type_list<TAIL...> tail;
44 template<typename TYPELIST, template <typename T> class PREDICATE>
47 template<template <typename T> class PREDICATE>
48 struct find_type<type_list<>, PREDICATE>
50 typedef false_type type;
53 template<typename TYPELIST, template <typename T> class PREDICATE>
56 typedef typename conditional<PREDICATE<typename TYPELIST::head>::value,
57 typename TYPELIST::head,
58 typename find_type<typename TYPELIST::tail, PREDICATE>::type>::type type;