]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/detail/operators/searchable.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / hana / detail / operators / searchable.hpp
1 /*!
2 @file
3 Defines operators for Searchables.
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_DETAIL_OPERATORS_SEARCHABLE_HPP
11 #define BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/fwd/at_key.hpp>
15
16
17 BOOST_HANA_NAMESPACE_BEGIN namespace detail {
18 template <typename Derived>
19 struct searchable_operators {
20 template <typename Key>
21 constexpr decltype(auto) operator[](Key&& key) & {
22 return hana::at_key(static_cast<Derived&>(*this),
23 static_cast<Key&&>(key));
24 }
25
26 template <typename Key>
27 constexpr decltype(auto) operator[](Key&& key) && {
28 return hana::at_key(static_cast<Derived&&>(*this),
29 static_cast<Key&&>(key));
30 }
31
32 template <typename Key>
33 constexpr decltype(auto) operator[](Key&& key) const& {
34 return hana::at_key(static_cast<Derived const&>(*this),
35 static_cast<Key&&>(key));
36 }
37 };
38 } BOOST_HANA_NAMESPACE_END
39
40 #endif // !BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP