1 // Copyright (c) 2018 Antony Polukhin 2 // 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) 5 6 #include <boost/pfr.hpp> 7 #include <boost/core/lightweight_test.hpp> 8 9 template <class T> 10 struct optional_like { 11 T val_; 12 13 optional_like() = default; optional_likeoptional_like14 template <class U> optional_like(U&& /*v*/){} 15 }; 16 17 struct Foo { 18 optional_like<int> a; 19 }; 20 main()21int main() { 22 Foo f{0}; 23 f.a.val_ = 5; 24 25 BOOST_TEST_EQ(boost::pfr::get<0>(f).val_, 5); 26 return boost::report_errors(); 27 } 28