Work around VC11 which has broken rebind_traits

VC11 has only partial support for C++11 allocators. For example it has a
non-conforming rebind_alloc and rebind_traits in std::allocator_traits
because it does not support C++11 template aliases.
This commit is contained in:
Glen Fernandes
2014-02-04 23:56:34 -08:00
parent 540149f019
commit 6d73b4aa54
3 changed files with 167 additions and 53 deletions
@@ -12,7 +12,7 @@
#include <boost/smart_ptr/detail/array_traits.hpp>
#include <boost/smart_ptr/detail/as_pair.hpp>
#include <boost/type_traits/alignment_of.hpp>
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#include <memory>
#endif
@@ -45,20 +45,20 @@ namespace boost {
template<typename T_, typename A_, typename Y_>
friend class as_allocator;
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#if !defined(BOOST_NO_CXX11_ALLOCATOR) && \
!defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
typedef typename std::allocator_traits<A>::
template rebind_alloc<Y> YA;
typedef typename std::allocator_traits<A>::
template rebind_alloc<char> CA;
typedef typename std::allocator_traits<A>::
template rebind_traits<Y> YT;
typedef typename std::allocator_traits<A>::
template rebind_traits<char> CT;
#else
typedef typename A::
template rebind<Y>::other YA;
typedef typename A::
template rebind<char>::other CA;
typedef typename A::template rebind<Y>::other YA;
typedef typename A::template rebind<char>::other CA;
#endif
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
typedef std::allocator_traits<YA> YT;
typedef std::allocator_traits<CA> CT;
#endif
public:
@@ -74,16 +74,19 @@ namespace boost {
}
private:
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#if !defined(BOOST_NO_CXX11_ALLOCATOR) && \
!defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
typedef typename std::allocator_traits<A>::
template rebind_alloc<type> TA;
typedef typename std::allocator_traits<A>::
template rebind_traits<type> TT;
#else
typedef typename A::
template rebind<type>::other TA;
#endif
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
typedef std::allocator_traits<TA> TT;
#endif
void destroy(type*, std::size_t, boost::true_type) {
}