1 // Copyright (c) 2019-2020 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 unconstrained_forwarding_ref
{
12 unconstrained_forwarding_ref() = default;
13 unconstrained_forwarding_ref(const unconstrained_forwarding_ref
&) = default;
14 unconstrained_forwarding_ref(unconstrained_forwarding_ref
&&) = default;
15 unconstrained_forwarding_ref
& operator=(const unconstrained_forwarding_ref
&) = default;
16 unconstrained_forwarding_ref
& operator=(unconstrained_forwarding_ref
&&) = default;
19 constexpr unconstrained_forwarding_ref(U
&& val
)
20 : value_
{std::forward
<U
>(val
)}
31 struct aggregate_unconstrained
{
32 unconstrained_forwarding_ref
<int> a
;
33 unconstrained_forwarding_ref
<int_element
> b
;
37 using sanity
= decltype(aggregate_unconstrained
{
38 boost::pfr::detail::ubiq_lref_constructor
{0},
39 boost::pfr::detail::ubiq_lref_constructor
{1},
43 sanity
, aggregate_unconstrained
45 "Precise reflection with template constructors sanity check fails"
48 boost::pfr::detail::enable_if_constructible_helper_t
<aggregate_unconstrained
, 2> foo
;
53 boost::pfr::tuple_element_t
<0, aggregate_unconstrained
>,
54 unconstrained_forwarding_ref
<int>
56 "Precise reflection with template constructors fails to work"
61 boost::pfr::tuple_element_t
<1, aggregate_unconstrained
>,
62 unconstrained_forwarding_ref
<int_element
>
64 "Precise reflection with template constructors fails to work"
67 aggregate_unconstrained aggr
{3, 4};
68 return boost::pfr::get
<1>(aggr
).value_
.value_
- 4;