Changeset 77017


Ignore:
Timestamp:
Feb 14, 2012, 11:55:09 PM (6 years ago)
Author:
Daniel James
Message:

Unordered: Use container's allocator_traits for old Visual C++.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/unordered/detail/allocator_helpers.hpp

    r76970 r77017  
    3232#       define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1
    3333#   endif
     34#
     35#   if defined(BOOST_MSVC) && BOOST_MSVC < 1400
     36#       define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 2
     37#   endif
    3438#endif
    3539
     
    3842#endif
    3943
    40 #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
     44#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
    4145#  include <memory>
     46#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 2
     47#  include <boost/container/allocator/allocator_traits.hpp>
    4248#endif
    4349
     
    202208    // (although untested as I don't have access to a standard version yet)
    203209
    204 #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
     210#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
    205211
    206212    template <typename Alloc>
     
    213219            template rebind_alloc<T> type;
    214220    };
     221
     222#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 2
     223
     224    template <typename Alloc>
     225    struct allocator_traits :
     226        boost::container::allocator_traits<Alloc> {};
     227
     228    template <typename Alloc, typename T>
     229    struct rebind_wrap :
     230        boost::container::allocator_traits<Alloc>::
     231            template portable_rebind_alloc<T>
     232    {};
    215233
    216234#else
  • trunk/libs/unordered/test/unordered/allocator_traits.cpp

    r76970 r77017  
    9191    typedef empty_allocator<int> allocator;
    9292    typedef boost::unordered::detail::allocator_traits<allocator> traits;
    93 #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
     93#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
    9494    BOOST_MPL_ASSERT((boost::is_same<traits::size_type,
    9595        std::make_unsigned<std::ptrdiff_t>::type>));
     
    129129    typedef allocator1<int> allocator;
    130130    typedef boost::unordered::detail::allocator_traits<allocator> traits;
    131 #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
     131#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
    132132    BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type,
    133133        std::make_unsigned<std::ptrdiff_t>::type>));
  • trunk/libs/unordered/test/unordered/minimal_allocator.cpp

    r76893 r77017  
    5353    BOOST_MPL_ASSERT((boost::is_same<typename traits::difference_type, std::ptrdiff_t>));
    5454
    55 #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
     55#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
    5656    BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type,
    5757        std::make_unsigned<std::ptrdiff_t>::type>));
Note: See TracChangeset for help on using the changeset viewer.