mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 06:24:26 +02:00
Added emplace optimization specializations for compilers with rvalue references but without variadic templates (e.g. MSVC10&11)
This commit is contained in:
@@ -386,6 +386,8 @@ struct BOOST_PP_CAT(insert_emplace_proxy_arg, N)
|
|||||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
|
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
|
||||||
#include BOOST_PP_LOCAL_ITERATE()
|
#include BOOST_PP_LOCAL_ITERATE()
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
|
||||||
//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type
|
//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type
|
||||||
template<class A, class Iterator>
|
template<class A, class Iterator>
|
||||||
struct insert_emplace_proxy_arg1<A, Iterator, ::boost::rv<typename boost::container::allocator_traits<A>::value_type> >
|
struct insert_emplace_proxy_arg1<A, Iterator, ::boost::rv<typename boost::container::allocator_traits<A>::value_type> >
|
||||||
@@ -404,7 +406,37 @@ struct insert_emplace_proxy_arg1<A, Iterator, typename boost::container::allocat
|
|||||||
: insert_copy_proxy<A, Iterator>(v)
|
: insert_copy_proxy<A, Iterator>(v)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
|
#else //e.g. MSVC10 & MSVC11
|
||||||
|
|
||||||
|
//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type
|
||||||
|
template<class A, class Iterator>
|
||||||
|
struct insert_emplace_proxy_arg1<A, Iterator, typename boost::container::allocator_traits<A>::value_type>
|
||||||
|
: public insert_move_proxy<A, Iterator>
|
||||||
|
{
|
||||||
|
explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits<A>::value_type &&v)
|
||||||
|
: insert_move_proxy<A, Iterator>(v)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class A, class Iterator>
|
||||||
|
struct insert_emplace_proxy_arg1<A, Iterator, typename boost::container::allocator_traits<A>::value_type &>
|
||||||
|
: public insert_copy_proxy<A, Iterator>
|
||||||
|
{
|
||||||
|
explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<A>::value_type &v)
|
||||||
|
: insert_copy_proxy<A, Iterator>(v)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class A, class Iterator>
|
||||||
|
struct insert_emplace_proxy_arg1<A, Iterator, const typename boost::container::allocator_traits<A>::value_type &>
|
||||||
|
: public insert_copy_proxy<A, Iterator>
|
||||||
|
{
|
||||||
|
explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<A>::value_type &v)
|
||||||
|
: insert_copy_proxy<A, Iterator>(v)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
template<class A, class Iterator>
|
template<class A, class Iterator>
|
||||||
struct insert_emplace_proxy_arg1<A, Iterator, const typename boost::container::allocator_traits<A>::value_type>
|
struct insert_emplace_proxy_arg1<A, Iterator, const typename boost::container::allocator_traits<A>::value_type>
|
||||||
: public insert_copy_proxy<A, Iterator>
|
: public insert_copy_proxy<A, Iterator>
|
||||||
@@ -413,7 +445,9 @@ struct insert_emplace_proxy_arg1<A, Iterator, const typename boost::container::a
|
|||||||
: insert_copy_proxy<A, Iterator>(v)
|
: insert_copy_proxy<A, Iterator>(v)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}}} //namespace boost { namespace container { namespace container_detail {
|
}}} //namespace boost { namespace container { namespace container_detail {
|
||||||
|
|
||||||
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||||
|
Reference in New Issue
Block a user