// Copyright Louis Dionne 2013-2017 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #ifndef BOOST_HANA_TEST_STRUCT_MINIMAL_STRUCT_HPP #define BOOST_HANA_TEST_STRUCT_MINIMAL_STRUCT_HPP #include #include #include #include #include #include template struct minimal_struct_tag; template struct minimal_struct_t { boost::hana::tuple members; using hana_tag = minimal_struct_tag; }; struct obj_t { template constexpr minimal_struct_t operator()(Members ...members) const { return {{static_cast(members)...}}; } }; constexpr obj_t obj{}; namespace boost { namespace hana { template struct accessors_impl> { template struct get_member { template constexpr decltype(auto) operator()(Struct&& s) const { return hana::at_c(static_cast(s).members); } }; static auto apply() { return hana::unpack(hana::range_c, [](auto ...k) { return hana::make_tuple( hana::make_pair(k, get_member{})... ); }); } }; }} #endif // !BOOST_HANA_TEST_STRUCT_MINIMAL_STRUCT_HPP