VTK  9.2.20220807
vtkTypeList.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTypeList.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
17 // The Loki Library
18 // Copyright (c) 2001 by Andrei Alexandrescu
19 // This code accompanies the book:
20 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
21 // Patterns Applied". Copyright (c) 2001. Addison-Wesley.
22 // Permission to use, copy, modify, distribute and sell this software for any
23 // purpose is hereby granted without fee, provided that the above copyright
24 // notice appear in all copies and that both that copyright notice and this
25 // permission notice appear in supporting documentation.
26 // The author or Addison-Wesley Longman make no representations about the
27 // suitability of this software for any purpose. It is provided "as is"
28 // without express or implied warranty.
30 
53 #ifndef vtkTypeList_h
54 #define vtkTypeList_h
55 
56 #include "vtkTypeListMacros.h"
57 
58 namespace vtkTypeList
59 {
60 
61 //------------------------------------------------------------------------------
65 struct NullType
66 {
67 };
68 
69 //------------------------------------------------------------------------------
71 
74 template <typename T, typename U>
75 struct TypeList
76 {
77  typedef T Head;
78  typedef U Tail;
79 };
81 
82 //------------------------------------------------------------------------------
86 template <bool Exp, typename T, typename F>
87 struct Select;
88 
89 //------------------------------------------------------------------------------
94 template <typename From, typename To>
95 struct CanConvert;
96 
97 //------------------------------------------------------------------------------
102 template <typename TList, typename T>
103 struct IndexOf;
104 
105 //------------------------------------------------------------------------------
110 template <typename TList, typename T>
111 struct Erase;
112 
113 //------------------------------------------------------------------------------
117 template <typename TList, typename T>
118 struct EraseAll;
119 
120 //------------------------------------------------------------------------------
125 template <typename TList>
126 struct Unique;
127 
128 //------------------------------------------------------------------------------
133 template <typename TList, typename Bad, typename Good>
134 struct Replace;
135 
136 //------------------------------------------------------------------------------
141 template <typename TList, typename Bad, typename Good>
142 struct ReplaceAll;
143 
144 //------------------------------------------------------------------------------
150 template <typename TList, typename T>
151 struct MostDerived;
152 
153 //------------------------------------------------------------------------------
159 template <typename TList>
161 
162 //------------------------------------------------------------------------------
166 template <typename TList, typename T>
167 struct Append;
168 
169 } // end namespace vtkTypeList
170 
171 #include "vtkTypeList.txx"
172 
173 namespace vtkTypeList
174 {
175 
176 template <typename... Ts>
177 using Create = typename vtkTypeList::detail::CreateImpl<Ts...>::type;
178 
179 } // end namespace vtkTypeList
180 
181 #endif // vtkTypeList_h
182 // VTK-HeaderTest-Exclude: vtkTypeList.h
typename vtkTypeList::detail::CreateImpl< Ts... >::type Create
Definition: vtkTypeList.h:177
@ type
Definition: vtkX3D.h:522
Appends type T to TypeList TList and stores the result in Result.
Definition: vtkTypeList.h:167
Sets member Result to true if a conversion exists to convert type From to type To.
Definition: vtkTypeList.h:95
Sort the TypeList from most-derived to least-derived type, storing the sorted TypeList in Result.
Definition: vtkTypeList.h:160
Erase all type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:118
Erase the first element of type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:111
Sets the enum value Result to the index of type T in the TypeList TList.
Definition: vtkTypeList.h:103
Given a type T and a TypeList TList, store the most derived type of T in TList as Result.
Definition: vtkTypeList.h:151
Used to terminate a TypeList.
Definition: vtkTypeList.h:66
Replace all instances of Bad with Good in the TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:142
Replace the first instance of Bad with Good in the TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:134
Sets Result to T if Exp is true, or F if Exp is false.
Definition: vtkTypeList.h:87
Generic implementation of TypeList.
Definition: vtkTypeList.h:76
Remove all duplicate types from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:126