Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00022
00023 #ifndef ICL_CORE_EXPLICIT_H_INCLUDED
00024 #define ICL_CORE_EXPLICIT_H_INCLUDED
00025
00026 #include <boost/type_traits.hpp>
00027
00028 namespace icl_core {
00029
00030 namespace internal {
00031
00033 template <bool cond> struct ExplicitEnforceMeaning
00034 { };
00035 template <> struct ExplicitEnforceMeaning<true>
00036 {
00037 enum { EXPLICIT_TYPE_MEANING_MUST_BE_AN_EMPTY_CLASS_TYPE = 0 };
00038 };
00039
00040 }
00041
00066 template <typename T, typename Meaning>
00067 struct Explicit
00068 {
00070 Explicit()
00071 {
00072 (void) internal::ExplicitEnforceMeaning<boost::is_stateless<Meaning>::value>::EXPLICIT_TYPE_MEANING_MUST_BE_AN_EMPTY_CLASS_TYPE;
00073 }
00074
00076 Explicit(T value)
00077 : value(value)
00078 { }
00079
00081 inline operator T () const { return value; }
00082
00084 T value;
00085 };
00086
00087 }
00088
00089 #endif