paludis
Version 2.6.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
paludis
util
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
<>
51
struct
MakeTypeListConstEntry
<
TypeListTail
>
52
{
53
typedef
TypeListTail
Type
;
54
};
55
56
template
<
typename
Item_,
typename
Tail_>
57
struct
MakeTypeListConstEntry
<
TypeListEntry
<Item_, Tail_> >
58
{
59
typedef
TypeListEntry<const Item_, typename MakeTypeListConstEntry<Tail_>::Type
>
Type
;
60
};
61
62
template
<
typename
TypeList_>
63
struct
MakeTypeListConst
64
{
65
typedef
typename
MakeTypeListConstEntry<TypeList_>::Type
Type
;
66
};
67
68
template
<
typename
Item_>
69
struct
TypeListContains
<
TypeListTail
, 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
{
83
enum
{ value =
TypeListContains<Tail_, Item_>::value
};
84
};
85
}
86
87
#endif
paludis
Definition:
about_metadata-fwd.hh:23
paludis::TypeListTail
Definition:
type_list.hh:27
paludis::MakeTypeListConst
Definition:
type_list-fwd.hh:40
paludis::TypeListEntry
Definition:
type_list-fwd.hh:28
paludis::MakeTypeListConstEntry
Definition:
type_list-fwd.hh:43
paludis::MakeTypeList
Definition:
type_list-fwd.hh:31
paludis::TypeListContains
Definition:
type_list-fwd.hh:46
Generated by
1.8.11