Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/interprocess/detail/utilities.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 |
---|---|
12 ////////////////////////////////////////////////////////////////////////////// | 12 ////////////////////////////////////////////////////////////////////////////// |
13 | 13 |
14 #ifndef BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP | 14 #ifndef BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP |
15 #define BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP | 15 #define BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP |
16 | 16 |
17 #if (defined _MSC_VER) && (_MSC_VER >= 1200) | 17 #ifndef BOOST_CONFIG_HPP |
18 # include <boost/config.hpp> | |
19 #endif | |
20 # | |
21 #if defined(BOOST_HAS_PRAGMA_ONCE) | |
18 # pragma once | 22 # pragma once |
19 #endif | 23 #endif |
20 | 24 |
21 #include <boost/interprocess/detail/config_begin.hpp> | 25 #include <boost/interprocess/detail/config_begin.hpp> |
22 #include <boost/interprocess/detail/workaround.hpp> | 26 #include <boost/interprocess/detail/workaround.hpp> |
23 | 27 |
24 #include <boost/interprocess/interprocess_fwd.hpp> | 28 #include <boost/interprocess/interprocess_fwd.hpp> |
25 #include <boost/move/move.hpp> | 29 #include <boost/move/utility_core.hpp> |
26 #include <boost/type_traits/has_trivial_destructor.hpp> | |
27 #include <boost/interprocess/detail/min_max.hpp> | 30 #include <boost/interprocess/detail/min_max.hpp> |
28 #include <boost/interprocess/detail/type_traits.hpp> | 31 #include <boost/interprocess/detail/type_traits.hpp> |
29 #include <boost/interprocess/detail/transform_iterator.hpp> | |
30 #include <boost/interprocess/detail/mpl.hpp> | 32 #include <boost/interprocess/detail/mpl.hpp> |
31 #include <boost/interprocess/containers/version_type.hpp> | |
32 #include <boost/intrusive/pointer_traits.hpp> | 33 #include <boost/intrusive/pointer_traits.hpp> |
33 #include <boost/move/move.hpp> | 34 #include <boost/move/utility_core.hpp> |
34 #include <boost/static_assert.hpp> | 35 #include <boost/static_assert.hpp> |
35 #include <utility> | |
36 #include <algorithm> | |
37 #include <climits> | 36 #include <climits> |
38 | 37 |
39 namespace boost { | 38 namespace boost { |
40 namespace interprocess { | 39 namespace interprocess { |
41 namespace ipcdetail { | 40 namespace ipcdetail { |
46 | 45 |
47 template <class Pointer> | 46 template <class Pointer> |
48 inline typename boost::intrusive::pointer_traits<Pointer>::element_type* | 47 inline typename boost::intrusive::pointer_traits<Pointer>::element_type* |
49 to_raw_pointer(const Pointer &p) | 48 to_raw_pointer(const Pointer &p) |
50 { return boost::interprocess::ipcdetail::to_raw_pointer(p.operator->()); } | 49 { return boost::interprocess::ipcdetail::to_raw_pointer(p.operator->()); } |
51 | |
52 //!To avoid ADL problems with swap | |
53 template <class T> | |
54 inline void do_swap(T& x, T& y) | |
55 { | |
56 using std::swap; | |
57 swap(x, y); | |
58 } | |
59 | 50 |
60 //Rounds "orig_size" by excess to round_to bytes | 51 //Rounds "orig_size" by excess to round_to bytes |
61 template<class SizeType> | 52 template<class SizeType> |
62 inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to) | 53 inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to) |
63 { | 54 { |
146 | 137 |
147 template<class SizeType> | 138 template<class SizeType> |
148 inline bool multiplication_overflows(SizeType a, SizeType b) | 139 inline bool multiplication_overflows(SizeType a, SizeType b) |
149 { | 140 { |
150 const SizeType sqrt_size_max = sqrt_size_type_max<SizeType>::value; | 141 const SizeType sqrt_size_max = sqrt_size_type_max<SizeType>::value; |
151 return //Fast runtime check | 142 return //Fast runtime check |
152 ( (a | b) > sqrt_size_max && | 143 ( (a | b) > sqrt_size_max && |
153 //Slow division check | 144 //Slow division check |
154 b && a > SizeType(-1)/b | 145 b && a > SizeType(-1)/b |
155 ); | 146 ); |
156 } | 147 } |
157 | 148 |
158 template<std::size_t SztSizeOfType, class SizeType> | 149 template<std::size_t SztSizeOfType, class SizeType> |
166 | 157 |
167 template<class RawPointer> | 158 template<class RawPointer> |
168 class pointer_size_t_caster | 159 class pointer_size_t_caster |
169 { | 160 { |
170 public: | 161 public: |
162 BOOST_STATIC_ASSERT(sizeof(std::size_t) == sizeof(void*)); | |
163 | |
171 explicit pointer_size_t_caster(std::size_t sz) | 164 explicit pointer_size_t_caster(std::size_t sz) |
172 : m_ptr(reinterpret_cast<RawPointer>(sz)) | 165 : m_ptr(reinterpret_cast<RawPointer>(sz)) |
173 {} | 166 {} |
174 | 167 |
175 explicit pointer_size_t_caster(RawPointer p) | 168 explicit pointer_size_t_caster(RawPointer p) |