VTK  9.7.1
vtkTypeList.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) 2001 by Andrei Alexandrescu
3 // SPDX-FileCopyrightText: Copyright (c) 2001. Addison-Wesley.
4 // SPDX-License-Identifier: BSD-3-Clause AND MIT
5 
7 // The Loki Library
8 // This code accompanies the book:
9 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
10 // Patterns Applied".
12 
35 #ifndef vtkTypeList_h
36 #define vtkTypeList_h
37 
38 #include "vtkABINamespace.h"
39 #include "vtkTypeListMacros.h"
40 
41 namespace vtkTypeList
42 {
43 VTK_ABI_NAMESPACE_BEGIN
44 
45 //------------------------------------------------------------------------------
49 struct NullType
50 {
51 };
52 
53 //------------------------------------------------------------------------------
55 
58 template <typename T, typename U>
59 struct TypeList
60 {
61  typedef T Head;
62  typedef U Tail;
63 };
65 
66 //------------------------------------------------------------------------------
70 template <typename TList>
71 struct Size;
72 
73 //------------------------------------------------------------------------------
77 template <bool Exp, typename T, typename F>
78 struct Select;
79 
80 //------------------------------------------------------------------------------
85 template <typename From, typename To>
86 struct CanConvert;
87 
88 //------------------------------------------------------------------------------
93 template <typename TList, typename T>
94 struct IndexOf;
95 
96 //------------------------------------------------------------------------------
101 template <typename TList, typename T>
102 struct Erase;
103 
104 //------------------------------------------------------------------------------
108 template <typename TList, typename T>
109 struct EraseAll;
110 
111 //------------------------------------------------------------------------------
116 template <typename TList>
117 struct Unique;
118 
119 //------------------------------------------------------------------------------
124 template <typename TList, typename Bad, typename Good>
125 struct Replace;
126 
127 //------------------------------------------------------------------------------
132 template <typename TList, typename Bad, typename Good>
133 struct ReplaceAll;
134 
135 //------------------------------------------------------------------------------
141 template <typename TList, typename T>
142 struct MostDerived;
143 
144 //------------------------------------------------------------------------------
150 template <typename TList>
152 
153 //------------------------------------------------------------------------------
158 template <typename TList, typename T, typename... Rest>
159 struct Append;
160 
161 VTK_ABI_NAMESPACE_END
162 } // end namespace vtkTypeList
163 
164 #include "vtkTypeList.txx"
165 
166 namespace vtkTypeList
167 {
168 VTK_ABI_NAMESPACE_BEGIN
169 
170 template <typename... Ts>
171 using Create = typename vtkTypeList::detail::CreateImpl<Ts...>::type;
172 
173 VTK_ABI_NAMESPACE_END
174 } // end namespace vtkTypeList
175 
176 #endif // vtkTypeList_h
177 // VTK-HeaderTest-Exclude: vtkTypeList.h
Used to terminate a TypeList.
Definition: vtkTypeList.h:49
Remove all duplicate types from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:117
Sets the enum value Result to the index of type T in the TypeList TList.
Definition: vtkTypeList.h:94
Sets member Result to true if a conversion exists to convert type From to type To.
Definition: vtkTypeList.h:86
Replace the first instance of Bad with Good in the TypeList TList, storing the new list in Result...
Definition: vtkTypeList.h:125
typename vtkTypeList::detail::CreateImpl< Ts... >::type Create
Definition: vtkTypeList.h:171
Given a type T and a TypeList TList, store the most derived type of T in TList as Result...
Definition: vtkTypeList.h:142
Get the Size of the TypeList TList.
Definition: vtkTypeList.h:71
Generic implementation of TypeList.
Definition: vtkTypeList.h:59
Replace all instances of Bad with Good in the TypeList TList, storing the new list in Result...
Definition: vtkTypeList.h:133
Appends types/TypeLists to TypeList TList and stores the result in Result.
Definition: vtkTypeList.h:159
Sets Result to T if Exp is true, or F if Exp is false.
Definition: vtkTypeList.h:78
Erase the first element of type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:102
Sort the TypeList from most-derived to least-derived type, storing the sorted TypeList in Result...
Definition: vtkTypeList.h:151
Erase all type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:109