]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/at.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / at.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines `boost::hana::at` and `boost::hana::at_c`.
4
5@copyright Louis Dionne 2013-2016
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_AT_HPP
11#define BOOST_HANA_AT_HPP
12
13#include <boost/hana/fwd/at.hpp>
14
15#include <boost/hana/concept/integral_constant.hpp>
16#include <boost/hana/concept/iterable.hpp>
17#include <boost/hana/config.hpp>
18#include <boost/hana/core/dispatch.hpp>
19#include <boost/hana/integral_constant.hpp>
20
21#include <cstddef>
22
23
24BOOST_HANA_NAMESPACE_BEGIN
25 //! @cond
26 template <typename Xs, typename N>
27 constexpr decltype(auto) at_t::operator()(Xs&& xs, N const& n) const {
28 using It = typename hana::tag_of<Xs>::type;
29 using At = BOOST_HANA_DISPATCH_IF(at_impl<It>,
30 hana::Iterable<It>::value
31 );
32
33 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
34 static_assert(hana::Iterable<It>::value,
35 "hana::at(xs, n) requires 'xs' to be an Iterable");
36
37 static_assert(hana::IntegralConstant<N>::value,
38 "hana::at(xs, n) requires 'n' to be an IntegralConstant");
39 #endif
40
41 return At::apply(static_cast<Xs&&>(xs), n);
42 }
43 //! @endcond
44
45 template <typename It, bool condition>
46 struct at_impl<It, when<condition>> : default_ {
47 template <typename ...Args>
48 static constexpr auto apply(Args&& ...) = delete;
49 };
50
51 template <std::size_t n, typename Xs>
52 constexpr decltype(auto) at_c(Xs&& xs) {
53 return hana::at(static_cast<Xs&&>(xs), hana::size_t<n>{});
54 }
55BOOST_HANA_NAMESPACE_END
56
57#endif // !BOOST_HANA_AT_HPP