1/*!
2@file
3Defines operators for Iterables.
4
5Copyright Louis Dionne 2013-2022
6Distributed 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
17namespace boost { namespace hana { 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} }} // end namespace boost::hana
39
40#endif // !BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP
41

source code of boost/libs/hana/include/boost/hana/detail/operators/iterable.hpp