IsProxy.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TYPETRAITS_ISPROXY_H_
36 #define _BLAZE_MATH_TYPETRAITS_ISPROXY_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/util/FalseType.h>
45 #include <blaze/util/SelectType.h>
46 #include <blaze/util/TrueType.h>
48 
49 
50 namespace blaze {
51 
52 //=================================================================================================
53 //
54 // CLASS DEFINITION
55 //
56 //=================================================================================================
57 
58 //*************************************************************************************************
63 template< typename T >
64 struct IsProxyHelper
65 {
66  private:
67  //**********************************************************************************************
68  typedef typename RemoveCV<T>::Type T2;
69 
70  typedef char (&Yes)[1];
71  typedef char (&No) [2];
72 
73  template< typename PT, typename RT >
74  static Yes test( const Proxy<PT,RT>& );
75 
76  static No test( ... );
77 
78  static T2 create();
79  //**********************************************************************************************
80 
81  public:
82  //**********************************************************************************************
83  enum { value = ( sizeof( test( create() ) ) == sizeof( Yes ) ) };
84  typedef typename SelectType< value, TrueType, FalseType >::Type Type;
85  //**********************************************************************************************
86 };
88 //*************************************************************************************************
89 
90 
91 //*************************************************************************************************
115 template< typename T >
116 struct IsProxy : public IsProxyHelper<T>::Type
117 {
118  public:
119  //**********************************************************************************************
121  enum { value = IsProxyHelper<T>::value };
122  typedef typename IsProxyHelper<T>::Type Type;
124  //**********************************************************************************************
125 };
126 //*************************************************************************************************
127 
128 } // namespace blaze
129 
130 #endif
Header file for the FalseType type/value trait base class.
Header file for the RemoveCV type trait.
Compile time check for proxy types.This type trait tests whether or not the given template parameter ...
Definition: IsProxy.h:116
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the SelectType class template.
Header file for all forward declarations for proxies.
Header file for the TrueType type/value trait base class.