]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/drop_front.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / hana / drop_front.hpp
1 /*!
2 @file
3 Defines `boost::hana::drop_front`.
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_DROP_FRONT_HPP
11 #define BOOST_HANA_DROP_FRONT_HPP
12
13 #include <boost/hana/fwd/drop_front.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/core/tag_of.hpp>
20 #include <boost/hana/integral_constant.hpp>
21
22
23 BOOST_HANA_NAMESPACE_BEGIN
24 //! @cond
25 template <typename Xs, typename N>
26 constexpr auto drop_front_t::operator()(Xs&& xs, N const& n) const {
27 using It = typename hana::tag_of<Xs>::type;
28 using DropFront = BOOST_HANA_DISPATCH_IF(drop_front_impl<It>,
29 hana::Iterable<It>::value &&
30 hana::IntegralConstant<N>::value
31 );
32
33 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
34 static_assert(hana::Iterable<It>::value,
35 "hana::drop_front(xs, n) requires 'xs' to be an Iterable");
36
37 static_assert(hana::IntegralConstant<N>::value,
38 "hana::drop_front(xs, n) requires 'n' to be an IntegralConstant");
39 #endif
40
41 return DropFront::apply(static_cast<Xs&&>(xs), n);
42 }
43
44 template <typename Xs>
45 constexpr auto drop_front_t::operator()(Xs&& xs) const {
46 return (*this)(static_cast<Xs&&>(xs), hana::size_t<1>{});
47 }
48 //! @endcond
49
50 template <typename It, bool condition>
51 struct drop_front_impl<It, when<condition>> : default_ {
52 template <typename Xs, typename N>
53 static constexpr auto apply(Xs&&, N const&) = delete;
54 };
55 BOOST_HANA_NAMESPACE_END
56
57 #endif // !BOOST_HANA_DROP_FRONT_HPP