comparison DEPENDENCIES/generic/include/boost/detail/dynamic_bitset.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 // Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek 3 // Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek
4 // Copyright (c) 2003-2006, 2008 Gennaro Prota 4 // Copyright (c) 2003-2006, 2008 Gennaro Prota
5 //
6 // Copyright (c) 2014 Glen Joseph Fernandes
7 // glenfe at live dot com
5 // 8 //
6 // Distributed under the Boost Software License, Version 1.0. 9 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt or copy at 10 // (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt) 11 // http://www.boost.org/LICENSE_1_0.txt)
9 // 12 //
10 // ----------------------------------------------------------- 13 // -----------------------------------------------------------
11 14
12 #ifndef BOOST_DETAIL_DYNAMIC_BITSET_HPP 15 #ifndef BOOST_DETAIL_DYNAMIC_BITSET_HPP
13 #define BOOST_DETAIL_DYNAMIC_BITSET_HPP 16 #define BOOST_DETAIL_DYNAMIC_BITSET_HPP
14 17
18 #include <memory>
15 #include <cstddef> 19 #include <cstddef>
16 #include "boost/config.hpp" 20 #include "boost/config.hpp"
17 #include "boost/detail/workaround.hpp" 21 #include "boost/detail/workaround.hpp"
18 22
19 23
153 // 157 //
154 // from vector<>::max_size. This tries to get more 158 // from vector<>::max_size. This tries to get more
155 // meaningful info. 159 // meaningful info.
156 // 160 //
157 template <typename T> 161 template <typename T>
158 typename T::size_type vector_max_size_workaround(const T & v) { 162 inline typename T::size_type vector_max_size_workaround(const T & v)
159 163 BOOST_NOEXCEPT
160 typedef typename T::allocator_type allocator_type; 164 {
161 165 typedef typename T::allocator_type allocator_type;
162 const typename allocator_type::size_type alloc_max = 166
163 v.get_allocator().max_size(); 167 const allocator_type& alloc = v.get_allocator();
164 const typename T::size_type container_max = v.max_size(); 168
165 169 #if !defined(BOOST_NO_CXX11_ALLOCATOR)
166 return alloc_max < container_max? 170 typedef std::allocator_traits<allocator_type> allocator_traits;
167 alloc_max : 171
168 container_max; 172 const typename allocator_traits::size_type alloc_max =
173 allocator_traits::max_size(alloc);
174 #else
175 const typename allocator_type::size_type alloc_max = alloc.max_size();
176 #endif
177
178 const typename T::size_type container_max = v.max_size();
179
180 return alloc_max < container_max ? alloc_max : container_max;
169 } 181 }
170 182
171 // for static_asserts 183 // for static_asserts
172 template <typename T> 184 template <typename T>
173 struct allowed_block_type { 185 struct allowed_block_type {