]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/include/boost/hana/detail/operators/iterable.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / detail / operators / iterable.hpp
1 /*!
2 @file
3 Defines operators for Iterables.
4
5 @copyright Louis Dionne 2013-2016
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_ITERABLE_HPP
11 #define BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/fwd/at.hpp>
15
16
17 BOOST_HANA_NAMESPACE_BEGIN namespace detail {
18 template <typename Derived>
19 struct iterable_operators {
20 template <typename N>
21 constexpr decltype(auto) operator[](N&& n) & {
22 return hana::at(static_cast<Derived&>(*this),
23 static_cast<N&&>(n));
24 }
25
26 template <typename N>
27 constexpr decltype(auto) operator[](N&& n) const& {
28 return hana::at(static_cast<Derived const&>(*this),
29 static_cast<N&&>(n));
30 }
31
32 template <typename N>
33 constexpr decltype(auto) operator[](N&& n) && {
34 return hana::at(static_cast<Derived&&>(*this),
35 static_cast<N&&>(n));
36 }
37 };
38 } BOOST_HANA_NAMESPACE_END
39
40 #endif // !BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP