File indexing completed on 2025-01-18 09:38:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_ACCESSORS_HPP
0011 #define BOOST_HANA_ACCESSORS_HPP
0012
0013 #include <boost/hana/fwd/accessors.hpp>
0014
0015 #include <boost/hana/concept/struct.hpp>
0016 #include <boost/hana/config.hpp>
0017 #include <boost/hana/core/dispatch.hpp>
0018
0019
0020 namespace boost { namespace hana {
0021 template <typename S>
0022 struct accessors_t {
0023 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
0024 static_assert(hana::Struct<S>::value,
0025 "hana::accessors<S> requires 'S' to be a Struct");
0026 #endif
0027
0028 constexpr decltype(auto) operator()() const {
0029 using Accessors = BOOST_HANA_DISPATCH_IF(accessors_impl<S>,
0030 hana::Struct<S>::value
0031 );
0032
0033 return Accessors::apply();
0034 }
0035 };
0036
0037 template <typename S, bool condition>
0038 struct accessors_impl<S, when<condition>> : default_ {
0039 template <typename ...Args>
0040 static constexpr auto apply(Args&& ...) = delete;
0041 };
0042
0043 namespace struct_detail {
0044 template <typename ...>
0045 struct is_valid { static constexpr bool value = true; };
0046 }
0047
0048 template <typename S>
0049 struct accessors_impl<S, when<
0050 struct_detail::is_valid<typename S::hana_accessors_impl>::value
0051 >>
0052 : S::hana_accessors_impl
0053 { };
0054 }}
0055
0056 #endif