VTK
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 
51 #ifndef vtkTypeList_h
52 #define vtkTypeList_h
53 
54 #include "vtkTypeListMacros.h"
55 
56 namespace vtkTypeList
57 {
58 
59 //------------------------------------------------------------------------------
63 struct NullType {};
64 
65 //------------------------------------------------------------------------------
67 
70 template <typename T, typename U>
71 struct TypeList
72 {
73  typedef T Head;
74  typedef U Tail;
75 };
77 
78 //------------------------------------------------------------------------------
82 template <bool Exp, typename T, typename F>
83 struct Select;
84 
85 //------------------------------------------------------------------------------
90 template <typename From, typename To>
91 struct CanConvert;
92 
93 //------------------------------------------------------------------------------
98 template <typename TList, typename T>
99 struct IndexOf;
100 
101 //------------------------------------------------------------------------------
106 template <typename TList, typename T>
107 struct Erase;
108 
109 //------------------------------------------------------------------------------
113 template <typename TList, typename T>
114 struct EraseAll;
115 
116 //------------------------------------------------------------------------------
121 template <typename TList>
122 struct Unique;
123 
124 //------------------------------------------------------------------------------
129 template <typename TList, typename Bad, typename Good>
130 struct Replace;
131 
132 //------------------------------------------------------------------------------
137 template <typename TList, typename Bad, typename Good>
138 struct ReplaceAll;
139 
140 //------------------------------------------------------------------------------
146 template <typename TList, typename T>
147 struct MostDerived;
148 
149 //------------------------------------------------------------------------------
155 template <typename TList>
157 
158 //------------------------------------------------------------------------------
162 template <typename TList, typename T>
163 struct Append;
164 
165 } // end namespace vtkTypeList
166 
167 #include "vtkTypeList.txx"
168 
169 #endif // vtkTypeList_h
170 // VTK-HeaderTest-Exclude: vtkTypeList.h
Used to terminate a TypeList.
Definition: vtkTypeList.h:63
Remove all duplicate types from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:122
Sets the enum value Result to the index of type T in the TypeList TList.
Definition: vtkTypeList.h:99
Sets member Result to true if a conversion exists to convert type From to type To.
Definition: vtkTypeList.h:91
Replace the first instance of Bad with Good in the TypeList TList, storing the new list in Result...
Definition: vtkTypeList.h:130
Given a type T and a TypeList TList, store the most derived type of T in TList as Result...
Definition: vtkTypeList.h:147
Generic implementation of TypeList.
Definition: vtkTypeList.h:71
Replace all instances of Bad with Good in the TypeList TList, storing the new list in Result...
Definition: vtkTypeList.h:138
Appends type T to TypeList TList and stores the result in Result.
Definition: vtkTypeList.h:163
Sets Result to T if Exp is true, or F if Exp is false.
Definition: vtkTypeList.h:83
Erase the first element of type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:107
Sort the TypeList from most-derived to least-derived type, storing the sorted TypeList in Result...
Definition: vtkTypeList.h:156
Erase all type T from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:114