integral_constant.hpp
Go to the documentation of this file.
1 // (C) Copyright John Maddock 2015.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
7 #define BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
8 
9 #include <boost/config.hpp>
11 
12 #if (BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
13  || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
14  || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) \
15  || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
16  || BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(810)) )
17 
18 
19 namespace boost{
20  namespace mpl
21  {
22  template <bool B> struct bool_;
23  template <class I, I val> struct integral_c;
24  struct integral_c_tag;
25  }
26 }
27 
28 #else
29 
30 namespace mpl_{
31 
32  template <bool B> struct bool_;
33  template <class I, I val> struct integral_c;
34  struct integral_c_tag;
35 }
36 
37 namespace boost
38 {
39  namespace mpl
40  {
41  using ::mpl_::bool_;
42  using ::mpl_::integral_c;
43  using ::mpl_::integral_c_tag;
44  }
45 }
46 
47 #endif
48 
49 namespace boost{
50 
51  template <class T, T val>
53  {
54  typedef mpl::integral_c_tag tag;
55  typedef T value_type;
57  static const T value = val;
58  //
59  // This helper function is just to disable type-punning
60  // warnings from GCC:
61  //
62  template <class U>
63  static U& dereference(U* p) { return *p; }
64 
65  operator const mpl::integral_c<T, val>& ()const
66  {
67  static const char data[sizeof(long)] = { 0 };
68  return dereference(reinterpret_cast<const mpl::integral_c<T, val>*>(&data));
69  }
70  BOOST_CONSTEXPR operator T()const { return val; }
71  };
72 
73  template <class T, T val>
75 
76  template <bool val>
77  struct integral_constant<bool, val>
78  {
79  typedef mpl::integral_c_tag tag;
80  typedef bool value_type;
82  static const bool value = val;
83  //
84  // This helper function is just to disable type-punning
85  // warnings from GCC:
86  //
87  template <class T>
88  static T& dereference(T* p) { return *p; }
89 
90  operator const mpl::bool_<val>& ()const
91  {
92  static const char data = 0;
93  return dereference(reinterpret_cast<const mpl::bool_<val>*>(&data));
94  }
95  BOOST_CONSTEXPR operator bool()const { return val; }
96  };
97 
98  template <bool val>
100 
103 
104 }
105 
106 #endif
T
T
Definition: mem_fn_cc.hpp:25
config.hpp
mpl_::integral_c
Definition: integral_constant.hpp:33
BOOST_CONSTEXPR
#define BOOST_CONSTEXPR
Definition: suffix.hpp:961
integral_c_tag
Definition: integral_c_tag.hpp:22
boost::integral_constant::value_type
T value_type
Definition: integral_constant.hpp:55
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::integral_constant::type
integral_constant< T, val > type
Definition: integral_constant.hpp:56
data
data
boost::integral_constant< bool, val >::dereference
static T & dereference(T *p)
Definition: integral_constant.hpp:88
boost::integral_constant::tag
mpl::integral_c_tag tag
Definition: integral_constant.hpp:54
boost::false_type
integral_constant< bool, false > false_type
Definition: integral_constant.hpp:102
boost::integral_constant< bool, val >::value_type
bool value_type
Definition: integral_constant.hpp:80
boost::integral_constant< bool, val >::value
static const bool value
Definition: integral_constant.hpp:82
mpl_::bool_
Definition: integral_constant.hpp:32
mpl_
Definition: integral_constant.hpp:30
boost::true_type
integral_constant< bool, true > true_type
Definition: integral_constant.hpp:101
integral_c
Definition: integral_c_fwd.hpp:26
boost::integral_constant< bool, val >
Definition: integral_constant.hpp:77
boost::integral_constant< bool, val >::tag
mpl::integral_c_tag tag
Definition: integral_constant.hpp:79
boost::integral_constant::dereference
static U & dereference(U *p)
Definition: integral_constant.hpp:63
boost::integral_constant< bool, val >::type
integral_constant< bool, val > type
Definition: integral_constant.hpp:81
workaround.hpp
bool_
Definition: mpl/bool.hpp:23
boost::integral_constant
Definition: integral_constant.hpp:52
boost::integral_constant::value
static const T value
Definition: integral_constant.hpp:57


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:39:59