VTK  9.3.20231130
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 <bool Exp, typename T, typename F>
71 struct Select;
72 
73 //------------------------------------------------------------------------------
78 template <typename From, typename To>
79 struct CanConvert;
80 
81 //------------------------------------------------------------------------------
86 template <typename TList, typename T>
87 struct IndexOf;
88 
89 //------------------------------------------------------------------------------
94 template <typename TList, typename T>
95 struct Erase;
96 
97 //------------------------------------------------------------------------------
101 template <typename TList, typename T>
102 struct EraseAll;
103 
104 //------------------------------------------------------------------------------
109 template <typename TList>
110 struct Unique;
111 
112 //------------------------------------------------------------------------------
117 template <typename TList, typename Bad, typename Good>
118 struct Replace;
119 
120 //------------------------------------------------------------------------------
125 template <typename TList, typename Bad, typename Good>
126 struct ReplaceAll;
127 
128 //------------------------------------------------------------------------------
134 template <typename TList, typename T>
135 struct MostDerived;
136 
137 //------------------------------------------------------------------------------
143 template <typename TList>
145 
146 //------------------------------------------------------------------------------
150 template <typename TList, typename T>
151 struct Append;
152 
153 VTK_ABI_NAMESPACE_END
154 } // end namespace vtkTypeList
155 
156 #include "vtkTypeList.txx"
157 
158 namespace vtkTypeList
159 {
160 VTK_ABI_NAMESPACE_BEGIN
161 
162 template <typename... Ts>
163 using Create = typename vtkTypeList::detail::CreateImpl<Ts...>::type;
164 
165 VTK_ABI_NAMESPACE_END
166 } // end namespace vtkTypeList
167 
168 #endif // vtkTypeList_h
169 // VTK-HeaderTest-Exclude: vtkTypeList.h
typename vtkTypeList::detail::CreateImpl< Ts... >::type Create
Definition: vtkTypeList.h:163
@ type
Definition: vtkX3D.h:516
Appends type T to TypeList TList and stores the result in Result.
Definition: vtkTypeList.h:151
Sets member Result to true if a conversion exists to convert type From to type To.
Definition: vtkTypeList.h:79
Sort the TypeList from most-derived to least-derived type, storing the sorted TypeList in Result.
Definition: vtkTypeList.h:144
Erase all type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:102
Erase the first element of type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:95
Sets the enum value Result to the index of type T in the TypeList TList.
Definition: vtkTypeList.h:87
Given a type T and a TypeList TList, store the most derived type of T in TList as Result.
Definition: vtkTypeList.h:135
Used to terminate a TypeList.
Definition: vtkTypeList.h:50
Replace all instances of Bad with Good in the TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:126
Replace the first instance of Bad with Good in the TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:118
Sets Result to T if Exp is true, or F if Exp is false.
Definition: vtkTypeList.h:71
Generic implementation of TypeList.
Definition: vtkTypeList.h:60
Remove all duplicate types from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:110