mirror of
https://github.com/boostorg/detail.git
synced 2025-07-30 04:17:14 +02:00
stricter check in is_partial_std_allocator
[SVN r23067]
This commit is contained in:
@ -13,7 +13,6 @@
|
|||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/mpl/aux_/msvc_never_true.hpp>
|
#include <boost/mpl/aux_/msvc_never_true.hpp>
|
||||||
#include <boost/mpl/apply_if.hpp>
|
#include <boost/mpl/apply_if.hpp>
|
||||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -30,42 +29,6 @@ namespace detail{
|
|||||||
|
|
||||||
namespace allocator{
|
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
|
/* partial_std_allocator_wrapper inherits the functionality of a std
|
||||||
* allocator while providing a templatized ctor.
|
* 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 */
|
/* rebind operations for defective std allocators */
|
||||||
|
|
||||||
template<typename Allocator,typename Type>
|
template<typename Allocator,typename Type>
|
||||||
|
Reference in New Issue
Block a user