paludis  Version 2.6.0
type_list.hh
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh
5  *
6  * This file is part of the Paludis package manager. Paludis is free software;
7  * you can redistribute it and/or modify it under the terms of the GNU General
8  * Public License version 2, as published by the Free Software Foundation.
9  *
10  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17  * Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef PALUDIS_GUARD_PALUDIS_UTIL_TYPE_LIST_HH
21 #define PALUDIS_GUARD_PALUDIS_UTIL_TYPE_LIST_HH 1
22 
23 #include <paludis/util/type_list-fwd.hh>
24 
25 namespace paludis
26 {
27  struct TypeListTail
28  {
29  };
30 
31  template <typename Item_, typename Tail_>
32  struct TypeListEntry
33  {
34  typedef Item_ Item;
35  typedef Tail_ Tail;
36  };
37 
38  template <>
39  struct MakeTypeList<>
40  {
41  typedef TypeListTail Type;
42  };
43 
44  template <typename H_, typename... T_>
45  struct MakeTypeList<H_, T_...>
46  {
47  typedef TypeListEntry<H_, typename MakeTypeList<T_...>::Type> Type;
48  };
49 
50  template <>
52  {
53  typedef TypeListTail Type;
54  };
55 
56  template <typename Item_, typename Tail_>
57  struct MakeTypeListConstEntry<TypeListEntry<Item_, Tail_> >
58  {
60  };
61 
62  template <typename TypeList_>
63  struct MakeTypeListConst
64  {
66  };
67 
68  template <typename Item_>
70  {
71  enum { value = 0 };
72  };
73 
74  template <typename Item_, typename Tail_>
75  struct TypeListContains<TypeListEntry<Item_, Tail_>, Item_>
76  {
77  enum { value = 1 };
78  };
79 
80  template <typename NotItem_, typename Item_, typename Tail_>
81  struct TypeListContains<TypeListEntry<NotItem_, Tail_>, Item_>
82  {
84  };
85 }
86 
87 #endif
Definition: about_metadata-fwd.hh:23
Definition: type_list.hh:27
Definition: type_list-fwd.hh:40
Definition: type_list-fwd.hh:28
Definition: type_list-fwd.hh:43
Definition: type_list-fwd.hh:31
Definition: type_list-fwd.hh:46