Make detail::as_allocator template C++11 friendly

This commit is contained in:
Glen Fernandes
2014-02-04 14:57:34 -08:00
parent af5141d492
commit 3ac6dbbf08
2 changed files with 18 additions and 9 deletions

View File

@ -143,21 +143,32 @@ namespace boost {
#endif
}
void construct(pointer memory, const Y& value) {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
YT::construct(pair, memory, value);
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename U, typename... Args>
void construct(U* memory, Args&&... args) {
YT::construct(pair, memory, std::forward<Args>(args)...);
}
#else
pair.construct(memory, value);
template<typename U>
void construct(U* memory, const Y& value) {
YT::construct(pair, memory, value);
}
#endif
template<typename U>
void destroy(U* memory) {
YT::destroy(pair, memory);
}
#else
void construct(pointer memory, const Y& value) {
pair.construct(memory, value);
}
void destroy(pointer memory) {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
YT::destroy(pair, memory);
#else
pair.destroy(memory);
#endif
}
#endif
template<typename U>
bool operator==(const as_allocator<T, A, U>& other) const {

View File

@ -74,7 +74,6 @@ namespace boost {
}
private:
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
typedef typename std::allocator_traits<A>::
template rebind_alloc<type> TA;
@ -314,7 +313,6 @@ namespace boost {
#endif
}
private:
type* object;
};
}