Blaze  3.6
Unique.h
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_TYPELIST_UNIQUE_H_
36 #define _BLAZE_UTIL_TYPELIST_UNIQUE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
46 
47 
48 namespace blaze {
49 
50 //=================================================================================================
51 //
52 // CLASS DEFINITION
53 //
54 //=================================================================================================
55 
56 //*************************************************************************************************
72 template< typename TL > // Type of the type list
73 struct Unique;
74 //*************************************************************************************************
75 
76 
77 //*************************************************************************************************
82 template<>
83 struct Unique< TypeList<> >
84 {
85  using Type = TypeList<>;
86 };
88 //*************************************************************************************************
89 
90 
91 //*************************************************************************************************
96 template< typename T // Type of the head of the type list
97  , typename... Ts > // Types of the tail of the type list
98 struct Unique< TypeList<T,Ts...> >
99 {
100  private:
101  using TL1 = typename Unique< TypeList<Ts...> >::Type;
102  using TL2 = typename Erase<TL1,T>::Type;
103 
104  public:
105  using Type = typename Append< TypeList<T>, TL2 >::Type;
106 };
108 //*************************************************************************************************
109 
110 
111 //*************************************************************************************************
124 template< typename TL > // Type of the type list
125 using Unique_t = typename Unique<TL>::Type;
126 //*************************************************************************************************
127 
128 } // namespace blaze
129 
130 #endif
Appending a type to a type list.The Append class can be used to append the data type T to a type list...
Definition: Append.h:69
Erasing the first occurrence of a type from a type list.The Erase class can be used to erase the firs...
Definition: Erase.h:74
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the Erase class template.
Implementation of a type list.The TypeList class template represents a list of data types of arbitrar...
Definition: TypeList.h:119
Erasing all duplicates from a type list.The Unique class can be used to erase all duplicates from a t...
Definition: Unique.h:73
Header file for the TypeList class template.
Header file for the Append class template.
typename Unique< TL >::Type Unique_t
Auxiliary alias declaration for the Unique class template.The Unique_t alias declaration provides a c...
Definition: Unique.h:125