File indexing completed on 2025-01-18 09:38:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_KEYS_HPP
0011 #define BOOST_HANA_KEYS_HPP
0012
0013 #include <boost/hana/fwd/keys.hpp>
0014
0015 #include <boost/hana/accessors.hpp>
0016 #include <boost/hana/concept/struct.hpp>
0017 #include <boost/hana/config.hpp>
0018 #include <boost/hana/core/dispatch.hpp>
0019 #include <boost/hana/first.hpp>
0020 #include <boost/hana/transform.hpp>
0021
0022
0023 namespace boost { namespace hana {
0024
0025 template <typename Map>
0026 constexpr auto keys_t::operator()(Map&& map) const {
0027 return keys_impl<typename hana::tag_of<Map>::type>::apply(
0028 static_cast<Map&&>(map)
0029 );
0030 }
0031
0032
0033 template <typename T, bool condition>
0034 struct keys_impl<T, when<condition>> : default_ {
0035 template <typename ...Args>
0036 static constexpr auto apply(Args&& ...) = delete;
0037 };
0038
0039 template <typename S>
0040 struct keys_impl<S, when<hana::Struct<S>::value>> {
0041 template <typename Object>
0042 static constexpr auto apply(Object const&) {
0043 return hana::transform(hana::accessors<S>(), hana::first);
0044 }
0045 };
0046 }}
0047
0048 #endif