stricter check in is_partial_std_allocator

[SVN r23067]
This commit is contained in:
Joaquín M. López Muñoz
2004-06-09 13:58:56 +00:00
parent f20d50a741
commit ec1d526862

View File

@ -13,7 +13,6 @@
#include <boost/detail/workaround.hpp>
#include <boost/mpl/aux_/msvc_never_true.hpp>
#include <boost/mpl/apply_if.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_same.hpp>
#include <cstddef>
#include <memory>
@ -30,42 +29,6 @@ namespace detail{
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<typename Allocator>
struct is_partial_std_allocator
{
BOOST_STATIC_CONSTANT(bool,
value=
(is_same<
std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
Allocator
>::value)||
(is_base_and_derived<
std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
Allocator
>::value));
};
#else
template<typename Allocator>
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.
*/
@ -93,6 +56,43 @@ public:
};
/* 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<typename Allocator>
struct is_partial_std_allocator
{
BOOST_STATIC_CONSTANT(bool,
value=
(is_same<
std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
Allocator
>::value)||
(is_same<
partial_std_allocator_wrapper<
BOOST_DEDUCED_TYPENAME Allocator::value_type>,
Allocator
>::value));
};
#else
template<typename Allocator>
struct is_partial_std_allocator
{
BOOST_STATIC_CONSTANT(bool,value=false);
};
#endif
/* rebind operations for defective std allocators */
template<typename Allocator,typename Type>