]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/include/boost/hana/fwd/drop_front_exactly.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / drop_front_exactly.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::drop_front_exactly`.
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_FWD_DROP_FRONT_EXACTLY_HPP
11 #define BOOST_HANA_FWD_DROP_FRONT_EXACTLY_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Drop the first `n` elements of an iterable, and return the rest.
19 //! @ingroup group-Iterable
20 //!
21 //! Given an `Iterable` `xs` with a linearization of `[x1, x2, ...]` and
22 //! a non-negative `IntegralConstant` `n`, `drop_front_exactly(xs, n)` is
23 //! an iterable with the same tag as `xs` whose linearization is
24 //! `[xn+1, xn+2, ...]`. In particular, note that this function does not
25 //! mutate the original iterable in any way. If `n` is not given, it
26 //! defaults to an `IntegralConstant` with a value equal to `1`.
27 //!
28 //! It is an error to use `drop_front_exactly` with `n > length(xs)`. This
29 //! additional guarantee allows `drop_front_exactly` to be better optimized
30 //! than the `drop_front` function, which allows `n > length(xs)`.
31 //!
32 //!
33 //! @param xs
34 //! The iterable from which elements are dropped.
35 //!
36 //! @param n
37 //! A non-negative `IntegralConstant` representing the number of elements
38 //! to be dropped from the iterable. In addition to being non-negative,
39 //! `n` must be less than or equal to the number of elements in `xs`.
40 //! If `n` is not given, it defaults to an `IntegralConstant` with a value
41 //! equal to `1`.
42 //!
43 //!
44 //! Example
45 //! -------
46 //! @include example/drop_front_exactly.cpp
47 #ifdef BOOST_HANA_DOXYGEN_INVOKED
48 constexpr auto drop_front_exactly = [](auto&& xs[, auto const& n]) {
49 return tag-dispatched;
50 };
51 #else
52 template <typename It, typename = void>
53 struct drop_front_exactly_impl : drop_front_exactly_impl<It, when<true>> { };
54
55 struct drop_front_exactly_t {
56 template <typename Xs, typename N>
57 constexpr auto operator()(Xs&& xs, N const& n) const;
58
59 template <typename Xs>
60 constexpr auto operator()(Xs&& xs) const;
61 };
62
63 constexpr drop_front_exactly_t drop_front_exactly{};
64 #endif
65 BOOST_HANA_NAMESPACE_END
66
67 #endif // !BOOST_HANA_FWD_DROP_FRONT_EXACTLY_HPP