////////////////////////////////////////////////////////////////////////////// // // (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 http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINER_DETAIL_POOL_COMMON_ALLOC_HPP #define BOOST_CONTAINER_DETAIL_POOL_COMMON_ALLOC_HPP #if defined(_MSC_VER) # pragma once #endif #include #include #include #include #include #include #include namespace boost{ namespace container{ namespace container_detail{ struct node_slist_helper : public boost::container::container_detail::node_slist {}; struct fake_segment_manager { typedef void * void_pointer; static const std::size_t PayloadPerAllocation = BOOST_CONTAINER_ALLOCATION_PAYLOAD; typedef boost::container::container_detail:: basic_multiallocation_chain multiallocation_chain; static void deallocate(void_pointer p) { boost_cont_free(p); } static void deallocate_many(multiallocation_chain &chain) { std::size_t size = chain.size(); std::pair ptrs = chain.extract_data(); boost_cont_memchain dlchain; BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&dlchain, ptrs.first, ptrs.second, size); boost_cont_multidealloc(&dlchain); } typedef std::ptrdiff_t difference_type; typedef std::size_t size_type; static void *allocate_aligned(std::size_t nbytes, std::size_t alignment) { void *ret = boost_cont_memalign(nbytes, alignment); if(!ret) boost::container::throw_bad_alloc(); return ret; } static void *allocate(std::size_t nbytes) { void *ret = boost_cont_malloc(nbytes); if(!ret) boost::container::throw_bad_alloc(); return ret; } }; } //namespace boost{ } //namespace container{ } //namespace container_detail{ namespace boost { namespace container { namespace container_detail { template struct is_stateless_segment_manager; template<> struct is_stateless_segment_manager { static const bool value = true; }; } //namespace container_detail { } //namespace container { } //namespace boost { #include #endif //BOOST_CONTAINER_DETAIL_POOL_COMMON_ALLOC_HPP