Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:37:41

0001 /*!
0002 @file
0003 Defines operators for Searchables.
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_DETAIL_OPERATORS_SEARCHABLE_HPP
0011 #define BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/fwd/at_key.hpp>
0015 
0016 
0017 namespace boost { namespace hana { namespace detail {
0018     template <typename Derived>
0019     struct searchable_operators {
0020         template <typename Key>
0021         constexpr decltype(auto) operator[](Key&& key) & {
0022             return hana::at_key(static_cast<Derived&>(*this),
0023                                 static_cast<Key&&>(key));
0024         }
0025 
0026         template <typename Key>
0027         constexpr decltype(auto) operator[](Key&& key) && {
0028             return hana::at_key(static_cast<Derived&&>(*this),
0029                                 static_cast<Key&&>(key));
0030         }
0031 
0032         template <typename Key>
0033         constexpr decltype(auto) operator[](Key&& key) const& {
0034             return hana::at_key(static_cast<Derived const&>(*this),
0035                                 static_cast<Key&&>(key));
0036         }
0037     };
0038 } }} // end namespace boost::hana
0039 
0040 #endif // !BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP