VTK  9.5.20251104
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
41namespace vtkTypeList
42{
43VTK_ABI_NAMESPACE_BEGIN
44
45//------------------------------------------------------------------------------
50{
51};
52
53//------------------------------------------------------------------------------
55
58template <typename T, typename U>
60{
61 typedef T Head;
62 typedef U Tail;
63};
65
66//------------------------------------------------------------------------------
70template <typename TList>
71struct Size;
72
73//------------------------------------------------------------------------------
77template <bool Exp, typename T, typename F>
78struct Select;
79
80//------------------------------------------------------------------------------
85template <typename From, typename To>
87
88//------------------------------------------------------------------------------
93template <typename TList, typename T>
94struct IndexOf;
95
96//------------------------------------------------------------------------------
101template <typename TList, typename T>
102struct Erase;
103
104//------------------------------------------------------------------------------
108template <typename TList, typename T>
109struct EraseAll;
110
111//------------------------------------------------------------------------------
116template <typename TList>
117struct Unique;
118
119//------------------------------------------------------------------------------
124template <typename TList, typename Bad, typename Good>
125struct Replace;
126
127//------------------------------------------------------------------------------
132template <typename TList, typename Bad, typename Good>
134
135//------------------------------------------------------------------------------
141template <typename TList, typename T>
143
144//------------------------------------------------------------------------------
150template <typename TList>
152
153//------------------------------------------------------------------------------
158template <typename TList, typename T, typename... Rest>
159struct Append;
160
161VTK_ABI_NAMESPACE_END
162} // end namespace vtkTypeList
163
164#include "vtkTypeList.txx"
165
166namespace vtkTypeList
167{
168VTK_ABI_NAMESPACE_BEGIN
169
170template <typename... Ts>
171using Create = typename vtkTypeList::detail::CreateImpl<Ts...>::type;
172
173VTK_ABI_NAMESPACE_END
174} // end namespace vtkTypeList
175
176#endif // vtkTypeList_h
177// VTK-HeaderTest-Exclude: vtkTypeList.h
typename vtkTypeList::detail::CreateImpl< Ts... >::type Create
Appends types/TypeLists to TypeList TList and stores the result in Result.
Sets member Result to true if a conversion exists to convert type From to type To.
Definition vtkTypeList.h:86
Sort the TypeList from most-derived to least-derived type, storing the sorted TypeList in Result.
Erase all type T from TypeList TList, storing the new list in Result.
Erase the first element of type T from TypeList TList, storing the new list in Result.
Sets the enum value Result to the index of type T in the TypeList TList.
Definition vtkTypeList.h:94
Given a type T and a TypeList TList, store the most derived type of T in TList as Result.
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.
Replace the first instance of Bad with Good in the TypeList TList, storing the new list in Result.
Sets Result to T if Exp is true, or F if Exp is false.
Definition vtkTypeList.h:78
Get the Size of the TypeList TList.
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.