forked from boostorg/container
Fix piecewise_construct pair constructor for compilers with variadics and constructor forwarding. Current code unconditionally moves instead of forwarding.
This commit is contained in:
1 parent
79a75f470e
commit
db5c24e0e7
3 files changed
+25
-12
No files matched your search
@@ -214,10 +214,10 @@ struct pair
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
# if !defined(BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS)
|
||||
private:
|
||||
template<class Tuple1, class Tuple2, size_t... Indexes1, size_t... Indexes2>
|
||||
pair(Tuple1& t1, Tuple2& t2, index_tuple<Indexes1...>, index_tuple<Indexes2...>)
|
||||
: first (get<Indexes1>(::boost::move(t1))...)
|
||||
, second(get<Indexes2>(::boost::move(t2))...)
|
||||
template<template<class ...> class Tuple, class... Args1, class... Args2, size_t... Indexes1, size_t... Indexes2>
|
||||
pair(Tuple<Args1...>& t1, Tuple<Args2...>& t2, index_tuple<Indexes1...>, index_tuple<Indexes2...>)
|
||||
: first (::boost::forward<Args1>(get<Indexes1>(t1))...)
|
||||
, second(::boost::forward<Args2>(get<Indexes2>(t2))...)
|
||||
{ (void) t1; (void)t2; }
|
||||
|
||||
public:
|
||||
|
||||
@@ -42,13 +42,13 @@ class tuple<Head, Tail...>
|
||||
typedef tuple<Tail...> inherited;
|
||||
|
||||
public:
|
||||
tuple() { }
|
||||
tuple()
|
||||
: inherited(), m_head()
|
||||
{}
|
||||
|
||||
// implicit copy-constructor is okay
|
||||
// Construct tuple from separate arguments.
|
||||
tuple(typename add_const_reference<Head>::type v,
|
||||
typename add_const_reference<Tail>::type... vtail)
|
||||
: inherited(vtail...), m_head(v)
|
||||
template<class U, class ...Args>
|
||||
tuple(U &&u, Args && ...args)
|
||||
: inherited(::boost::forward<Args>(args)...), m_head(::boost::forward<U>(u))
|
||||
{}
|
||||
|
||||
// Construct tuple from another tuple.
|
||||
@@ -77,8 +77,8 @@ class tuple<Head, Tail...>
|
||||
|
||||
|
||||
template<typename... Values>
|
||||
tuple<Values&&...> tie_forward(Values&&... values)
|
||||
{ return tuple<Values&&...>(values...); }
|
||||
tuple<Values&&...> forward_as_tuple(Values&&... values)
|
||||
{ return tuple<Values&&...>(::boost::forward<Values>(values)...); }
|
||||
|
||||
template<int I, typename Tuple>
|
||||
struct tuple_element;
|
||||
|
||||
Reference in new issue
Block a user