Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/container/detail/destroyers.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/container/detail/destroyers.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/container/detail/destroyers.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2012. +// (C) Copyright Ion Gaztanaga 2005-2013. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -13,15 +13,20 @@ #ifndef BOOST_CONTAINER_DESTROYERS_HPP #define BOOST_CONTAINER_DESTROYERS_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif -#include "config_begin.hpp" +#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/workaround.hpp> + +#include <boost/container/allocator_traits.hpp> +#include <boost/container/detail/to_raw_pointer.hpp> #include <boost/container/detail/version_type.hpp> -#include <boost/container/detail/utilities.hpp> -#include <boost/container/allocator_traits.hpp> namespace boost { namespace container { @@ -29,22 +34,20 @@ //!A deleter for scoped_ptr that deallocates the memory //!allocated for an object using a STL allocator. -template <class A> +template <class Allocator> struct scoped_deallocator { - typedef allocator_traits<A> allocator_traits_type; + typedef allocator_traits<Allocator> allocator_traits_type; typedef typename allocator_traits_type::pointer pointer; typedef container_detail::integral_constant<unsigned, boost::container::container_detail:: - version<A>::value> alloc_version; - typedef container_detail::integral_constant<unsigned, 1> allocator_v1; - typedef container_detail::integral_constant<unsigned, 2> allocator_v2; + version<Allocator>::value> alloc_version; private: - void priv_deallocate(allocator_v1) + void priv_deallocate(version_1) { m_alloc.deallocate(m_ptr, 1); } - void priv_deallocate(allocator_v2) + void priv_deallocate(version_2) { m_alloc.deallocate_one(m_ptr); } BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator) @@ -52,9 +55,9 @@ public: pointer m_ptr; - A& m_alloc; + Allocator& m_alloc; - scoped_deallocator(pointer p, A& a) + scoped_deallocator(pointer p, Allocator& a) : m_ptr(p), m_alloc(a) {} @@ -142,8 +145,6 @@ typedef container_detail::integral_constant<unsigned, boost::container::container_detail:: version<Allocator>::value> alloc_version; - typedef container_detail::integral_constant<unsigned, 1> allocator_v1; - typedef container_detail::integral_constant<unsigned, 2> allocator_v2; scoped_destroy_deallocator(pointer p, Allocator& a) : m_ptr(p), m_alloc(a) {} @@ -161,10 +162,10 @@ private: - void priv_deallocate(const pointer &p, allocator_v1) + void priv_deallocate(const pointer &p, version_1) { AllocTraits::deallocate(m_alloc, p, 1); } - void priv_deallocate(const pointer &p, allocator_v2) + void priv_deallocate(const pointer &p, version_2) { m_alloc.deallocate_one(p); } pointer m_ptr; @@ -197,13 +198,13 @@ void shrink_forward(size_type inc) { m_n -= inc; m_p += inc; } - + ~scoped_destructor_n() { if(!m_p) return; value_type *raw_ptr = container_detail::to_raw_pointer(m_p); while(m_n--){ - AllocTraits::destroy(m_a, raw_ptr); + AllocTraits::destroy(m_a, raw_ptr++); } } @@ -231,17 +232,20 @@ void increment_size_backwards(size_type) {} + void shrink_forward(size_type) + {} + void release() {} }; -template<class A> +template<class Allocator> class scoped_destructor { - typedef boost::container::allocator_traits<A> AllocTraits; + typedef boost::container::allocator_traits<Allocator> AllocTraits; public: - typedef typename A::value_type value_type; - scoped_destructor(A &a, value_type *pv) + typedef typename Allocator::value_type value_type; + scoped_destructor(Allocator &a, value_type *pv) : pv_(pv), a_(a) {} @@ -262,17 +266,17 @@ private: value_type *pv_; - A &a_; + Allocator &a_; }; -template<class A> +template<class Allocator> class value_destructor { - typedef boost::container::allocator_traits<A> AllocTraits; + typedef boost::container::allocator_traits<Allocator> AllocTraits; public: - typedef typename A::value_type value_type; - value_destructor(A &a, value_type &rv) + typedef typename Allocator::value_type value_type; + value_destructor(Allocator &a, value_type &rv) : rv_(rv), a_(a) {} @@ -283,7 +287,7 @@ private: value_type &rv_; - A &a_; + Allocator &a_; }; template <class Allocator> @@ -295,21 +299,19 @@ typedef container_detail::integral_constant<unsigned, boost::container::container_detail:: version<Allocator>::value> alloc_version; - typedef container_detail::integral_constant<unsigned, 1> allocator_v1; - typedef container_detail::integral_constant<unsigned, 2> allocator_v2; private: Allocator & a_; private: - void priv_deallocate(const pointer &p, allocator_v1) + void priv_deallocate(const pointer &p, version_1) { AllocTraits::deallocate(a_,p, 1); } - void priv_deallocate(const pointer &p, allocator_v2) + void priv_deallocate(const pointer &p, version_2) { a_.deallocate_one(p); } public: - allocator_destroyer(Allocator &a) + explicit allocator_destroyer(Allocator &a) : a_(a) {} @@ -320,41 +322,41 @@ } }; -template <class A> +template <class Allocator> class allocator_destroyer_and_chain_builder { - typedef allocator_traits<A> allocator_traits_type; + typedef allocator_traits<Allocator> allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; - typedef typename A::multiallocation_chain multiallocation_chain; + typedef typename Allocator::multiallocation_chain multiallocation_chain; - A & a_; + Allocator & a_; multiallocation_chain &c_; public: - allocator_destroyer_and_chain_builder(A &a, multiallocation_chain &c) + allocator_destroyer_and_chain_builder(Allocator &a, multiallocation_chain &c) : a_(a), c_(c) {} - void operator()(const typename A::pointer &p) + void operator()(const typename Allocator::pointer &p) { - allocator_traits<A>::destroy(a_, container_detail::to_raw_pointer(p)); + allocator_traits<Allocator>::destroy(a_, container_detail::to_raw_pointer(p)); c_.push_back(p); } }; -template <class A> +template <class Allocator> class allocator_multialloc_chain_node_deallocator { - typedef allocator_traits<A> allocator_traits_type; + typedef allocator_traits<Allocator> allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; - typedef typename A::multiallocation_chain multiallocation_chain; - typedef allocator_destroyer_and_chain_builder<A> chain_builder; + typedef typename Allocator::multiallocation_chain multiallocation_chain; + typedef allocator_destroyer_and_chain_builder<Allocator> chain_builder; - A & a_; + Allocator & a_; multiallocation_chain c_; public: - allocator_multialloc_chain_node_deallocator(A &a) + allocator_multialloc_chain_node_deallocator(Allocator &a) : a_(a), c_() {}