is_enum.hpp
Go to the documentation of this file.
1 
2 // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
3 // Hinnant & John Maddock 2000.
4 // Use, modification and distribution are subject to the Boost Software License,
5 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt).
7 //
8 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
9 
10 
11 #ifndef BOOST_TT_IS_ENUM_HPP_INCLUDED
12 #define BOOST_TT_IS_ENUM_HPP_INCLUDED
13 
16 #ifndef BOOST_IS_ENUM
22 #ifdef __GNUC__
24 #endif
26 #if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
29 #endif
30 #endif
31 
32 namespace boost {
33 
34 #ifndef BOOST_IS_ENUM
35 #if !(defined(__BORLANDC__) && (__BORLANDC__ <= 0x551))
36 
37 namespace detail {
38 
39 #if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
40 
41 template <typename T>
42 struct is_class_or_union
43 {
45 };
46 
47 #else
48 
49 template <typename T>
51 {
52 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))// we simply can't detect it this way.
53  BOOST_STATIC_CONSTANT(bool, value = false);
54 # else
55  template <class U> static ::boost::type_traits::yes_type is_class_or_union_tester(void(U::*)(void));
56 
57 # if BOOST_WORKAROUND(__MWERKS__, <= 0x3000) // no SFINAE
58  static ::boost::type_traits::no_type is_class_or_union_tester(...);
60  bool, value = sizeof(is_class_or_union_tester(0)) == sizeof(::boost::type_traits::yes_type));
61 # else
62  template <class U>
63  static ::boost::type_traits::no_type is_class_or_union_tester(...);
65  bool, value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(::boost::type_traits::yes_type));
66 # endif
67 # endif
68 };
69 #endif
70 
72 {
73  int_convertible(int);
74 };
75 
76 // Don't evaluate convertibility to int_convertible unless the type
77 // is non-arithmetic. This suppresses warnings with GCC.
78 template <bool is_typename_arithmetic_or_reference = true>
80 {
81  template <typename T> struct type
82  {
83  BOOST_STATIC_CONSTANT(bool, value = false);
84  };
85 };
86 
87 template <>
88 struct is_enum_helper<false>
89 {
90  template <typename T> struct type
91  {
93  };
94 };
95 
96 template <typename T> struct is_enum_impl
97 {
98  //typedef ::boost::add_reference<T> ar_t;
99  //typedef typename ar_t::type r_type;
100 
101 #if defined(__GNUC__)
102 
103 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
104 
105  // We MUST check for is_class_or_union on conforming compilers in
106  // order to correctly deduce that noncopyable types are not enums
107  // (dwa 2002/04/15)...
108  BOOST_STATIC_CONSTANT(bool, selector =
113  || is_array<T>::value);
114 #else
115  // ...however, not checking is_class_or_union on non-conforming
116  // compilers prevents a dependency recursion.
117  BOOST_STATIC_CONSTANT(bool, selector =
121  || is_array<T>::value);
122 #endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
123 
124 #else // !defined(__GNUC__):
125 
126  BOOST_STATIC_CONSTANT(bool, selector =
130  || is_array<T>::value);
131 
132 #endif
133 
134 #if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
135  typedef ::boost::detail::is_enum_helper<
137  > se_t;
138 #else
139  typedef ::boost::detail::is_enum_helper<selector> se_t;
140 #endif
141 
142  typedef typename se_t::template type<T> helper;
144 };
145 
146 } // namespace detail
147 
148 template <class T> struct is_enum : public integral_constant<bool, ::boost::detail::is_enum_impl<T>::value> {};
149 
150 #else // __BORLANDC__
151 //
152 // buggy is_convertible prevents working
153 // implementation of is_enum:
154 template <class T> struct is_enum : public integral_constant<bool, false> {};
155 
156 #endif
157 
158 #else // BOOST_IS_ENUM
159 
160 template <class T> struct is_enum : public integral_constant<bool, BOOST_IS_ENUM(T)> {};
161 
162 #endif
163 
164 } // namespace boost
165 
166 #endif // BOOST_TT_IS_ENUM_HPP_INCLUDED
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
se_t::template type< T > helper
Definition: is_enum.hpp:142
GLfloat value
::boost::detail::is_enum_helper< selector > se_t
Definition: is_enum.hpp:139
BOOST_STATIC_CONSTANT(bool, value=sizeof(is_class_or_union_tester< T >(0))==sizeof(::boost::type_traits::yes_type))
const char * detail
static::boost::type_traits::yes_type is_class_or_union_tester(void(U::*)(void))


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:17