1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // template <class T1, class T2> struct pair
15 // struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
16 // constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
22 #include "test_macros.h"
29 constexpr A(int i
, char c
) : i_(i
), c_(c
) {}
30 constexpr int get_i() const {return i_
;}
31 constexpr char get_c() const {return c_
;}
40 constexpr explicit B(double d
, unsigned u1
, unsigned u2
) : d_(d
), u1_(u1
), u2_(u2
) {}
41 constexpr double get_d() const {return d_
;}
42 constexpr unsigned get_u1() const {return u1_
;}
43 constexpr unsigned get_u2() const {return u2_
;}
49 std::pair
<A
, B
> p(std::piecewise_construct
,
50 std::make_tuple(4, 'a'),
51 std::make_tuple(3.5, 6u, 2u));
52 assert(p
.first
.get_i() == 4);
53 assert(p
.first
.get_c() == 'a');
54 assert(p
.second
.get_d() == 3.5);
55 assert(p
.second
.get_u1() == 6u);
56 assert(p
.second
.get_u2() == 2u);
64 #if TEST_STD_VER >= 20
65 static_assert(test());