/*! @file Defines `boost::hana::members`. @copyright Louis Dionne 2013-2016 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_MEMBERS_HPP #define BOOST_HANA_MEMBERS_HPP #include #include #include #include #include #include #include BOOST_HANA_NAMESPACE_BEGIN //! @cond template constexpr auto members_t::operator()(Object&& object) const { using S = typename hana::tag_of::type; using Members = BOOST_HANA_DISPATCH_IF(members_impl, hana::Struct::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Struct::value, "hana::members(object) requires 'object' to be a Struct"); #endif return Members::apply(static_cast(object)); } //! @endcond namespace struct_detail { template struct members_helper { Holder object; template constexpr decltype(auto) operator()(Accessor&& accessor) const { return hana::second(static_cast(accessor))( static_cast(object) ); } }; } template struct members_impl> : default_ { template static constexpr auto apply(Object&& object) { return hana::transform(hana::accessors(), struct_detail::members_helper{object} ); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_MEMBERS_HPP