1 // Copyright (c) 2019-2022 Antony Polukhin.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/pfr/core.hpp>
11 struct constrained_template
{
12 constrained_template() = default;
17 std::is_constructible
<T
, U
&&>::value
18 || sizeof(decltype(T
{std::declval
<U
&&>()}))
20 constexpr constrained_template(U
&& val
)
21 : value_
{std::forward
<U
>(val
)}
31 struct aggregate_constrained
{
32 constrained_template
<short> a
;
33 constrained_template
<int_element
> b
;
39 boost::pfr::tuple_element_t
<0, aggregate_constrained
>,
40 constrained_template
<short>
42 "Precise reflection with template constructors fails to work"
47 boost::pfr::tuple_element_t
<1, aggregate_constrained
>,
48 constrained_template
<int_element
>
50 "Precise reflection with template constructors fails to work"
54 aggregate_constrained aggr
{s
, 4};
55 return boost::pfr::get
<1>(aggr
).value_
.value_
- 4;