template<class T, class Tp> T make_from_tuple(Tp&& tp);+
template<class T, class Tp> T construct_from_tuple(Tp&& tp);
diff --git a/doc/html/mp11.html b/doc/html/mp11.html index 3454142..0fb5124 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -592,7 +592,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
N
is std::tuple_size<typename std::remove_reference&
-make_from_tuple<T>(tp)
+construct_from_tuple<T>(tp)
-template<class T, class Tp> T make_from_tuple(Tp&& tp);
+template<class T, class Tp> T construct_from_tuple(Tp&& tp);
-make_from_tuple<T>(tp)
returns T(std::get<J>(std::forward<Tp>(tp))…)
for J
in 0..N-1
,
-where N
is std::tuple_size<typename std::remove_reference<Tp>::type>::value
. Same as std::make_from_tuple
in C++17.
+construct_from_tuple<T>(tp)
returns T(std::get<J>(std::forward<Tp>(tp))…)
for J
in 0..N-1
,
+where N
is std::tuple_size<typename std::remove_reference<Tp>::type>::value
. Same as std::make_from_tuple
in C++17.
+The name of the function doesn’t match the C++17 one to avoid ambiguities when both are visible or in unqualified calls.
diff --git a/doc/mp11/tuple.adoc b/doc/mp11/tuple.adoc
index 2dc9f99..46baab3 100644
--- a/doc/mp11/tuple.adoc
+++ b/doc/mp11/tuple.adoc
@@ -20,12 +20,13 @@ http://www.boost.org/LICENSE_1_0.txt
`tuple_apply(f, tp)` returns `std::forward(f)(std::get(std::forward(tp))...)` for `J` in 0..`N-1`,
where `N` is `std::tuple_size::type>::value`. Same as `std::apply` in C++17.
-## make_from_tuple(tp)
+## construct_from_tuple(tp)
- template T make_from_tuple(Tp&& tp);
+ template T construct_from_tuple(Tp&& tp);
-`make_from_tuple(tp)` returns `T(std::get(std::forward(tp))...)` for `J` in 0..`N-1`,
-where `N` is `std::tuple_size::type>::value`. Same as `std::make_from_tuple` in C++17.
+`construct_from_tuple(tp)` returns `T(std::get(std::forward(tp))...)` for `J` in 0..`N-1`,
+where `N` is `std::tuple_size::type>::value`. Same as `std::make_from_tuple` in {cpp}17.
+The name of the function doesn't match the {cpp}17 one to avoid ambiguities when both are visible or in unqualified calls.
## tuple_for_each(tp, f)
diff --git a/include/boost/mp11/tuple.hpp b/include/boost/mp11/tuple.hpp
index db8ce05..afcd119 100644
--- a/include/boost/mp11/tuple.hpp
+++ b/include/boost/mp11/tuple.hpp
@@ -41,11 +41,11 @@ BOOST_CONSTEXPR auto tuple_apply( F && f, Tp && tp )
return detail::tuple_apply_impl( std::forward(f), std::forward(tp), Seq() );
}
-// make_from_tuple
+// construct_from_tuple
namespace detail
{
-template BOOST_CONSTEXPR T make_from_tuple_impl( Tp && tp, integer_sequence )
+template BOOST_CONSTEXPR T construct_from_tuple_impl( Tp && tp, integer_sequence )
{
return T( std::get(std::forward(tp))... );
}
@@ -54,9 +54,9 @@ template BOOST_CONSTEXPR T make_from_tuple_
template::type>::value>>
-BOOST_CONSTEXPR T make_from_tuple( Tp && tp )
+BOOST_CONSTEXPR T construct_from_tuple( Tp && tp )
{
- return detail::make_from_tuple_impl( std::forward(tp), Seq() );
+ return detail::construct_from_tuple_impl( std::forward(tp), Seq() );
}
// tuple_for_each
diff --git a/include/boost/mp11_single.hpp b/include/boost/mp11_single.hpp
index b45c39f..7e658ab 100644
--- a/include/boost/mp11_single.hpp
+++ b/include/boost/mp11_single.hpp
@@ -2695,11 +2695,11 @@ BOOST_CONSTEXPR auto tuple_apply( F && f, Tp && tp )
return detail::tuple_apply_impl( std::forward(f), std::forward(tp), Seq() );
}
-// make_from_tuple
+// construct_from_tuple
namespace detail
{
-template BOOST_CONSTEXPR T make_from_tuple_impl( Tp && tp, integer_sequence )
+template BOOST_CONSTEXPR T construct_from_tuple_impl( Tp && tp, integer_sequence )
{
return T( std::get(std::forward(tp))... );
}
@@ -2708,9 +2708,9 @@ template BOOST_CONSTEXPR T make_from_tuple_
template::type>::value>>
-BOOST_CONSTEXPR T make_from_tuple( Tp && tp )
+BOOST_CONSTEXPR T construct_from_tuple( Tp && tp )
{
- return detail::make_from_tuple_impl( std::forward(tp), Seq() );
+ return detail::construct_from_tuple_impl( std::forward(tp), Seq() );
}
// tuple_for_each
diff --git a/test/Jamfile b/test/Jamfile
index fbad85d..a975fc3 100644
--- a/test/Jamfile
+++ b/test/Jamfile
@@ -95,11 +95,11 @@ run integer_sequence.cpp : : : $(REQ) ;
# tuple
run tuple_for_each.cpp : : : $(REQ) ;
-run tuple_for_each_cx.cpp : : : $(REQ) ;
+compile tuple_for_each_cx.cpp : : : $(REQ) ;
run tuple_apply.cpp : : : $(REQ) ;
-run tuple_apply_cx.cpp : : : $(REQ) ;
-run make_from_tuple.cpp : : : $(REQ) ;
-run make_from_tuple_cx.cpp : : : $(REQ) ;
+compile tuple_apply_cx.cpp : : : $(REQ) ;
+run construct_from_tuple.cpp : : : $(REQ) ;
+compile construct_from_tuple_cx.cpp : : : $(REQ) ;
# set
run mp_set_contains.cpp : : : $(REQ) ;
diff --git a/test/make_from_tuple.cpp b/test/construct_from_tuple.cpp
similarity index 79%
rename from test/make_from_tuple.cpp
rename to test/construct_from_tuple.cpp
index 491a4a7..d56bd3c 100644
--- a/test/make_from_tuple.cpp
+++ b/test/construct_from_tuple.cpp
@@ -38,13 +38,13 @@ struct T2
int main()
{
- using boost::mp11::make_from_tuple;
+ using boost::mp11::construct_from_tuple;
{
std::tuple tp{ 1, 2, 3 };
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -52,7 +52,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -64,7 +64,7 @@ int main()
std::tuple const tp{ 1, 2, 3 };
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -72,7 +72,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -86,7 +86,7 @@ int main()
{
std::tuple, std::unique_ptr, std::unique_ptr> tp{ std::unique_ptr(new int(1)), std::unique_ptr(new int(2)), std::unique_ptr(new int(3)) };
- T2 t2 = make_from_tuple( std::move(tp) );
+ T2 t2 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( *t2.x, 1 );
BOOST_TEST_EQ( *t2.y, 2 );
@@ -99,7 +99,7 @@ int main()
std::pair tp{ 1, 2 };
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -107,7 +107,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -119,7 +119,7 @@ int main()
std::pair const tp{ 1, 2 };
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -127,7 +127,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -139,7 +139,7 @@ int main()
std::array tp{{ 1, 2, 3 }};
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -147,7 +147,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -159,7 +159,7 @@ int main()
std::array const tp{{ 1, 2, 3 }};
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -167,7 +167,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 1 );
BOOST_TEST_EQ( t1.y, 2 );
@@ -179,7 +179,7 @@ int main()
std::tuple<> tp;
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 0 );
BOOST_TEST_EQ( t1.y, 0 );
@@ -187,7 +187,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 0 );
BOOST_TEST_EQ( t1.y, 0 );
@@ -199,7 +199,7 @@ int main()
std::array tp;
{
- T1 t1 = make_from_tuple( tp );
+ T1 t1 = construct_from_tuple( tp );
BOOST_TEST_EQ( t1.x, 0 );
BOOST_TEST_EQ( t1.y, 0 );
@@ -207,7 +207,7 @@ int main()
}
{
- T1 t1 = make_from_tuple( std::move(tp) );
+ T1 t1 = construct_from_tuple( std::move(tp) );
BOOST_TEST_EQ( t1.x, 0 );
BOOST_TEST_EQ( t1.y, 0 );
diff --git a/test/make_from_tuple_cx.cpp b/test/construct_from_tuple_cx.cpp
similarity index 85%
rename from test/make_from_tuple_cx.cpp
rename to test/construct_from_tuple_cx.cpp
index 70b7ff2..62ea3db 100644
--- a/test/make_from_tuple_cx.cpp
+++ b/test/construct_from_tuple_cx.cpp
@@ -30,12 +30,12 @@ struct T1
int main()
{
- using boost::mp11::make_from_tuple;
+ using boost::mp11::construct_from_tuple;
{
constexpr std::tuple tp{ 1, 2, 3 };
- constexpr auto r = make_from_tuple( tp );
+ constexpr auto r = construct_from_tuple( tp );
static_assert( r.x == 1, "r.x == 1" );
static_assert( r.y == 2, "r.y == 2" );
@@ -45,7 +45,7 @@ int main()
{
constexpr std::pair tp{ 1, 2 };
- constexpr auto r = make_from_tuple( tp );
+ constexpr auto r = construct_from_tuple( tp );
static_assert( r.x == 1, "r.x == 1" );
static_assert( r.y == 2, "r.y == 2" );
@@ -55,7 +55,7 @@ int main()
{
constexpr std::array tp{{ 1, 2, 3 }};
- constexpr auto r = make_from_tuple( tp );
+ constexpr auto r = construct_from_tuple( tp );
static_assert( r.x == 1, "r.x == 1" );
static_assert( r.y == 2, "r.y == 2" );
@@ -69,7 +69,7 @@ int main()
{
constexpr std::tuple<> tp;
- constexpr auto r = make_from_tuple( tp );
+ constexpr auto r = construct_from_tuple( tp );
static_assert( r.x == 0, "r.x == 0" );
static_assert( r.y == 0, "r.y == 0" );