Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:03

0001 /*!
0002 @file
0003 Defines `boost::hana::keys`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
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     //! @cond
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     //! @endcond
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 }} // end namespace boost::hana
0047 
0048 #endif // !BOOST_HANA_KEYS_HPP