From f20d50a74159b4926740add53f31684e35435e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20M=2E=20L=C3=B3pez=20Mu=C3=B1oz?= Date: Wed, 9 Jun 2004 10:18:28 +0000 Subject: [PATCH] renamed to allocator_utilities.hpp [SVN r23061] --- include/boost/detail/allocator.hpp | 178 ----------------------------- 1 file changed, 178 deletions(-) delete mode 100644 include/boost/detail/allocator.hpp diff --git a/include/boost/detail/allocator.hpp b/include/boost/detail/allocator.hpp deleted file mode 100644 index f35e45e..0000000 --- a/include/boost/detail/allocator.hpp +++ /dev/null @@ -1,178 +0,0 @@ -/* Copyright 2003-2004 Joaquín M López Muñoz. - * 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 Boost website at http://www.boost.org/ - */ - -#ifndef BOOST_DETAIL_ALLOCATOR_JMLM_HPP -#define BOOST_DETAIL_ALLOCATOR_JMLM_HPP - -#include /* keep it first to prevent nasty warns in MSVC */ -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost{ - -namespace detail{ - -/* Allocator adaption layer. Some stdlibs provide allocators without rebind - * and template ctors. These facilities are simulated with the external - * template class rebind_to and the aid of partial_std_allocator_wrapper. - */ - -namespace allocator{ - -/* Detects whether a given allocator belongs to a defective stdlib not - * having the required member templates. - * Note that it does not suffice to check the Boost.Config stdlib - * macros, as the user might have passed a custom, compliant allocator. - * The checks also considers partial_std_allocator_wrapper to be - * a standard defective allocator. - */ - -#if defined(BOOST_NO_STD_ALLOCATOR)&&\ - (defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB)) - -template -struct is_partial_std_allocator -{ - BOOST_STATIC_CONSTANT(bool, - value= - (is_same< - std::allocator, - Allocator - >::value)|| - (is_base_and_derived< - std::allocator, - Allocator - >::value)); -}; - -#else - -template -struct is_partial_std_allocator -{ - BOOST_STATIC_CONSTANT(bool,value=false); -}; - -#endif - -/* partial_std_allocator_wrapper inherits the functionality of a std - * allocator while providing a templatized ctor. - */ - -template -class partial_std_allocator_wrapper:public std::allocator -{ -public: - partial_std_allocator_wrapper(){}; - - template - partial_std_allocator_wrapper(const partial_std_allocator_wrapper&){} - -#if defined(BOOST_DINKUMWARE_STDLIB) - /* Dinkumware guys didn't provide a means to call allocate() without - * supplying a hint, in disagreement with the standard. - */ - - Type* allocate(std::size_t n,const void* hint=0) - { - std::allocator& a=*this; - return a.allocate(n,hint); - } -#endif - -}; - -/* rebind operations for defective std allocators */ - -template -struct partial_std_allocator_rebind_to -{ - typedef partial_std_allocator_wrapper type; -}; - -/* rebind operation in all other cases */ - -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) -/* Workaround for a problem in MSVC with dependent template typedefs - * when doing rebinding of allocators. - * Modeled after (thanks, Aleksey!) - */ - -template -struct rebinder -{ - template struct fake_allocator:Allocator{}; - template<> struct fake_allocator - { - template struct rebind{}; - }; - - template - struct result: - fake_allocator::value>:: - template rebind - { - }; -}; -#else -template -struct rebinder -{ - template - struct result:Allocator::BOOST_NESTED_TEMPLATE rebind - { - }; -}; -#endif - -template -struct compliant_allocator_rebind_to -{ - typedef typename rebinder:: - BOOST_NESTED_TEMPLATE result::other type; -}; - -/* rebind front-end */ - -template -struct rebind_to: - mpl::apply_if_c< - is_partial_std_allocator::value, - partial_std_allocator_rebind_to, - compliant_allocator_rebind_to - > -{ -}; - -/* allocator-independent versions of construct and destroy */ - -template -void construct(void* p,const Type& t) -{ - new (p) Type(t); -} - -template -void destroy(const Type* p) -{ - p->~Type(); -} - -} /* namespace boost::detail::allocator */ - -} /* namespace boost::detail */ - -} /* namespace boost */ - -#endif