int main(int, char**) { { using E = MoveOnly; using Tup = std::tuple<E, E, E>; static_assert(test_convertible<Tup, E, E, E>(), ""); Tup t = {E(0), E(1)}; static_assert(test_convertible<Tup, E, E>(), ""); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); assert(std::get<2>(t) == MoveOnly()); Tup t2 = {E(0)}; static_assert(test_convertible<Tup, E>(), ""); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == E()); assert(std::get<2>(t) == E()); } // Check that SFINAE is properly applied with the default reduced arity // constructor extensions. test_default_constructible_extension_sfinae(); test_example_from_docs(); return 0; }
int main() { { std::tuple<MoveOnly> t(MoveOnly(0)); assert(std::get<0>(t) == 0); } { std::tuple<MoveOnly, MoveOnly> t(MoveOnly(0), MoveOnly(1)); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); } { std::tuple<MoveOnly, MoveOnly, MoveOnly> t(MoveOnly(0), MoveOnly(1), MoveOnly(2)); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); assert(std::get<2>(t) == 2); } // extensions #ifdef _LIBCPP_VERSION { std::tuple<MoveOnly, MoveOnly, MoveOnly> t(MoveOnly(0), MoveOnly(1)); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == 1); assert(std::get<2>(t) == MoveOnly()); } { std::tuple<MoveOnly, MoveOnly, MoveOnly> t(MoveOnly(0)); assert(std::get<0>(t) == 0); assert(std::get<1>(t) == MoveOnly()); assert(std::get<2>(t) == MoveOnly()); } #endif #if TEST_STD_VER > 11 { constexpr std::tuple<Empty> t0{Empty()}; } { constexpr std::tuple<A, A> t(3, 2); static_assert(std::get<0>(t).id_ == 3, ""); } #endif // Check that SFINAE is properly applied with the default reduced arity // constructor extensions. test_default_constructible_extension_sfinae(); }