Subscriptable.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_CONSTRAINTS_SUBSCRIPTABLE_H_
36 #define _BLAZE_UTIL_CONSTRAINTS_SUBSCRIPTABLE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/util/Suffix.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // MUST_BE_SUBSCRIBTABLE CONSTRAINT
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
64 template< typename T >
65 struct CONSTRAINT_MUST_BE_SUBSCRIBTABLE_FAILED
66 {
67  private:
68  //**********************************************************************************************
69  static T createT();
70  //**********************************************************************************************
71 
72  public:
73  //**********************************************************************************************
74  enum { T_is_not_subscriptable = sizeof( createT()[0] ),
75  value = 1 };
76  //**********************************************************************************************
77 };
79 //*************************************************************************************************
80 
81 
82 //*************************************************************************************************
88 #define BLAZE_CONSTRAINT_MUST_BE_SUBSCRIPTABLE(T) \
89  typedef \
90  ::blaze::CONSTRAINT_TEST< \
91  ::blaze::CONSTRAINT_MUST_BE_SUBSCRIBTABLE_FAILED< T >::value > \
92  BLAZE_JOIN( CONSTRAINT_MUST_BE_SUBSCRIPTABLE_TYPEDEF, __LINE__ )
93 //*************************************************************************************************
94 
95 
96 
97 
98 //=================================================================================================
99 //
100 // MUST_BE_SUBSCRIBTABLE_AS_DECAYABLE_POINTER CONSTRAINT
101 //
102 //=================================================================================================
103 
104 //*************************************************************************************************
113 template< typename T >
114 struct CONSTRAINT_MUST_BE_SUBSCRIBTABLE_AS_DECAYABLE_POINTER_FAILED
115 {
116  private:
117  //**********************************************************************************************
118  static T createT();
119  //**********************************************************************************************
120 
121  public:
122  //**********************************************************************************************
123  enum { T_is_not_subscriptable = sizeof( 0[createT()] ),
124  value = 1 };
125  //**********************************************************************************************
126 };
128 //*************************************************************************************************
129 
130 
131 //*************************************************************************************************
137 #define BLAZE_CONSTRAINT_MUST_BE_SUBSCRIPTABLE_AS_DECAYABLE_POINTER(T) \
138  typedef \
139  ::blaze::CONSTRAINT_TEST< \
140  ::blaze::CONSTRAINT_MUST_BE_SUBSCRIBTABLE_AS_DECAYABLE_POINTER_FAILED< T >::value > \
141  BLAZE_JOIN( CONSTRAINT_MUST_BE_SUBSCRIBTABLE_AS_DECAYABLE_POINTER_TYPEDEF, __LINE__ )
142 //*************************************************************************************************
143 
144 } // namespace blaze
145 
146 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Constraint wrapper class.
Header file for compile time constraints.