]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/keys.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / hana / keys.hpp
1 /*!
2 @file
3 Defines `boost::hana::keys`.
4
5 @copyright Louis Dionne 2013-2017
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9
10 #ifndef BOOST_HANA_KEYS_HPP
11 #define BOOST_HANA_KEYS_HPP
12
13 #include <boost/hana/fwd/keys.hpp>
14
15 #include <boost/hana/accessors.hpp>
16 #include <boost/hana/concept/struct.hpp>
17 #include <boost/hana/config.hpp>
18 #include <boost/hana/core/dispatch.hpp>
19 #include <boost/hana/first.hpp>
20 #include <boost/hana/transform.hpp>
21
22
23 namespace boost { namespace hana {
24 //! @cond
25 template <typename Map>
26 constexpr auto keys_t::operator()(Map&& map) const {
27 return keys_impl<typename hana::tag_of<Map>::type>::apply(
28 static_cast<Map&&>(map)
29 );
30 }
31 //! @endcond
32
33 template <typename T, bool condition>
34 struct keys_impl<T, when<condition>> : default_ {
35 template <typename ...Args>
36 static constexpr auto apply(Args&& ...) = delete;
37 };
38
39 template <typename S>
40 struct keys_impl<S, when<hana::Struct<S>::value>> {
41 template <typename Object>
42 static constexpr auto apply(Object const&) {
43 return hana::transform(hana::accessors<S>(), hana::first);
44 }
45 };
46 }} // end namespace boost::hana
47
48 #endif // !BOOST_HANA_KEYS_HPP