comparison DEPENDENCIES/generic/include/boost/container/detail/mpl.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
1 ////////////////////////////////////////////////////////////////////////////// 1 //////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 // (C) Copyright Ion Gaztanaga 2005-2012. 3 // (C) Copyright Ion Gaztanaga 2005-2013.
4 // 4 //
5 // Distributed under the Boost Software License, Version 1.0. 5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at 6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt) 7 // http://www.boost.org/LICENSE_1_0.txt)
8 // 8 //
11 ////////////////////////////////////////////////////////////////////////////// 11 //////////////////////////////////////////////////////////////////////////////
12 12
13 #ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP 13 #ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
14 #define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP 14 #define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
15 15
16 #if defined(_MSC_VER) 16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
18 #endif
19
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
17 # pragma once 21 # pragma once
18 #endif 22 #endif
23
24 #include <boost/container/detail/config_begin.hpp>
25 #include <boost/container/detail/workaround.hpp>
19 26
20 #include <cstddef> 27 #include <cstddef>
21 28
22 namespace boost { 29 namespace boost {
23 namespace container { 30 namespace container {
35 { 42 {
36 static const bool value = C_; 43 static const bool value = C_;
37 operator bool() const { return bool_::value; } 44 operator bool() const { return bool_::value; }
38 }; 45 };
39 46
47 template< unsigned V_ >
48 struct unsigned_ : integral_constant<unsigned, V_>
49 {
50 static const unsigned value = V_;
51 operator unsigned() const { return unsigned_::value; }
52 };
53
40 typedef bool_<true> true_; 54 typedef bool_<true> true_;
41 typedef bool_<false> false_; 55 typedef bool_<false> false_;
42 56
43 typedef true_ true_type; 57 typedef true_ true_type;
44 typedef false_ false_type; 58 typedef false_ false_type;
64 struct disable_if : public enable_if_c<!Cond::value, T> {}; 78 struct disable_if : public enable_if_c<!Cond::value, T> {};
65 79
66 template <bool B, class T = void> 80 template <bool B, class T = void>
67 struct disable_if_c : public enable_if_c<!B, T> {}; 81 struct disable_if_c : public enable_if_c<!B, T> {};
68 82
83 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
84
85 template <class T, class U>
86 struct is_convertible
87 {
88 static const bool value = __is_convertible_to(T, U);
89 };
90
91 #else
92
69 template <class T, class U> 93 template <class T, class U>
70 class is_convertible 94 class is_convertible
71 { 95 {
72 typedef char true_t; 96 typedef char true_t;
73 class false_t { char dummy[2]; }; 97 class false_t { char dummy[2]; };
74 static true_t dispatch(U); 98 //use any_conversion as first parameter since in MSVC
99 //overaligned types can't go through ellipsis
75 static false_t dispatch(...); 100 static false_t dispatch(...);
76 static T trigger(); 101 static true_t dispatch(U);
102 static T &trigger();
77 public: 103 public:
78 enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; 104 static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
79 }; 105 };
106
107 #endif
80 108
81 template< 109 template<
82 bool C 110 bool C
83 , typename T1 111 , typename T1
84 , typename T2 112 , typename T2
108 }; 136 };
109 137
110 138
111 template <class Pair> 139 template <class Pair>
112 struct select1st 140 struct select1st
113 // : public std::unary_function<Pair, typename Pair::first_type> 141 {
114 { 142 typedef Pair argument_type;
143 typedef typename Pair::first_type result_type;
144
115 template<class OtherPair> 145 template<class OtherPair>
116 const typename Pair::first_type& operator()(const OtherPair& x) const 146 const typename Pair::first_type& operator()(const OtherPair& x) const
117 { return x.first; } 147 { return x.first; }
118 148
119 const typename Pair::first_type& operator()(const typename Pair::first_type& x) const 149 const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
121 }; 151 };
122 152
123 // identity is an extension: it is not part of the standard. 153 // identity is an extension: it is not part of the standard.
124 template <class T> 154 template <class T>
125 struct identity 155 struct identity
126 // : public std::unary_function<T,T> 156 {
127 { 157 typedef T argument_type;
158 typedef T result_type;
159
128 typedef T type; 160 typedef T type;
129 const T& operator()(const T& x) const 161 const T& operator()(const T& x) const
130 { return x; } 162 { return x; }
131 }; 163 };
132 164
146 struct ls_zeros<1> 178 struct ls_zeros<1>
147 { 179 {
148 static const std::size_t value = 0; 180 static const std::size_t value = 0;
149 }; 181 };
150 182
183 template <std::size_t OrigSize, std::size_t RoundTo>
184 struct ct_rounded_size
185 {
186 static const std::size_t value = ((OrigSize-1)/RoundTo+1)*RoundTo;
187 };
188
151 template <typename T> struct unvoid { typedef T type; }; 189 template <typename T> struct unvoid { typedef T type; };
152 template <> struct unvoid<void> { struct type { }; }; 190 template <> struct unvoid<void> { struct type { }; };
153 template <> struct unvoid<const void> { struct type { }; }; 191 template <> struct unvoid<const void> { struct type { }; };
154 192
155 } //namespace container_detail { 193 } //namespace container_detail {
156 } //namespace container { 194 } //namespace container {
157 } //namespace boost { 195 } //namespace boost {
158 196
197 #include <boost/container/detail/config_end.hpp>
198
159 #endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP 199 #endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
160 200