All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DerivedFrom.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_CONSTRAINTS_DERIVEDFROM_H_
36 #define _BLAZE_UTIL_CONSTRAINTS_DERIVEDFROM_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/util/Suffix.h>
46 
47 
48 namespace blaze {
49 
50 //=================================================================================================
51 //
52 // MUST_BE_DERIVED_FROM CONSTRAINT
53 //
54 //=================================================================================================
55 
56 //*************************************************************************************************
66 template< bool > struct CONSTRAINT_MUST_BE_DERIVED_FROM_FAILED;
67 template<> struct CONSTRAINT_MUST_BE_DERIVED_FROM_FAILED<true> { enum { value = 1 }; };
69 //*************************************************************************************************
70 
71 
72 //*************************************************************************************************
78 #define BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM(D,B) \
79  typedef \
80  ::blaze::CONSTRAINT_TEST< \
81  ::blaze::CONSTRAINT_MUST_BE_DERIVED_FROM_FAILED< ::blaze::IsBaseOf<B,D>::value >::value > \
82  BLAZE_JOIN( CONSTRAINT_MUST_BE_DERIVED_FROM_TYPEDEF, __LINE__ )
83 //*************************************************************************************************
84 
85 
86 
87 
88 //=================================================================================================
89 //
90 // MUST_NOT_BE_DERIVED_FROM CONSTRAINT
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
104 template< bool > struct CONSTRAINT_MUST_NOT_BE_DERIVED_FROM_FAILED;
105 template<> struct CONSTRAINT_MUST_NOT_BE_DERIVED_FROM_FAILED<true> { enum { value = 1 }; };
107 //*************************************************************************************************
108 
109 
110 //*************************************************************************************************
117 #define BLAZE_CONSTRAINT_MUST_NOT_BE_DERIVED_FROM(D,B) \
118  typedef \
119  ::blaze::CONSTRAINT_TEST< \
120  ::blaze::CONSTRAINT_MUST_NOT_BE_DERIVED_FROM_FAILED< !::blaze::IsBaseOf<B,D>::value >::value > \
121  BLAZE_JOIN( CONSTRAINT_MUST_NOT_BE_DERIVED_FROM_TYPEDEF, __LINE__ )
122 //*************************************************************************************************
123 
124 
125 
126 
127 //=================================================================================================
128 //
129 // MUST_BE_STRICTLY_DERIVED_FROM CONSTRAINT
130 //
131 //=================================================================================================
132 
133 //*************************************************************************************************
143 template< bool > struct CONSTRAINT_MUST_BE_STRICTLY_DERIVED_FROM_FAILED;
144 template<> struct CONSTRAINT_MUST_BE_STRICTLY_DERIVED_FROM_FAILED<true> { enum { value = 1 }; };
146 //*************************************************************************************************
147 
148 
149 //*************************************************************************************************
157 #define BLAZE_CONSTRAINT_MUST_BE_STRICTLY_DERIVED_FROM(D,B) \
158  typedef \
159  ::blaze::CONSTRAINT_TEST< \
160  ::blaze::CONSTRAINT_MUST_BE_STRICTLY_DERIVED_FROM_FAILED< ::blaze::IsBaseOf<B,D>::value && \
161  !::blaze::IsBaseOf<D,B>::value >::value > \
162  BLAZE_JOIN( CONSTRAINT_MUST_BE_STRICTLY_DERIVED_FROM_TYPEDEF, __LINE__ )
163 //*************************************************************************************************
164 
165 
166 
167 
168 //=================================================================================================
169 //
170 // MUST_BE_STRICTLY_DERIVED_FROM CONSTRAINT
171 //
172 //=================================================================================================
173 
174 //*************************************************************************************************
184 template< bool > struct CONSTRAINT_MUST_NOT_BE_STRICTLY_DERIVED_FROM_FAILED;
185 template<> struct CONSTRAINT_MUST_NOT_BE_STRICTLY_DERIVED_FROM_FAILED<true> { enum { value = 1 }; };
187 //*************************************************************************************************
188 
189 
190 //*************************************************************************************************
198 #define BLAZE_CONSTRAINT_MUST_NOT_BE_STRICTLY_DERIVED_FROM(D,B) \
199  typedef \
200  ::blaze::CONSTRAINT_TEST< \
201  ::blaze::CONSTRAINT_MUST_NOT_BE_STRICTLY_DERIVED_FROM_FAILED< !::blaze::IsBaseOf<B,D>::value || \
202  ::blaze::IsBaseOf<D,B>::value >::value > \
203  BLAZE_JOIN( CONSTRAINT_MUST_NOT_BE_STRICTLY_DERIVED_FROM_TYPEDEF, __LINE__ )
204 //*************************************************************************************************
205 
206 } // namespace blaze
207 
208 #endif
Constraint wrapper class.
Header file for the IsBaseOf type trait.
Header file for compile time constraints.