]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/fwd/drop_back.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / drop_back.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Forward declares `boost::hana::drop_back`.
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_FWD_DROP_BACK_HPP
11#define BOOST_HANA_FWD_DROP_BACK_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/when.hpp>
15
16
17BOOST_HANA_NAMESPACE_BEGIN
18 //! Drop the last `n` elements of a finite sequence, and return the rest.
19 //! @ingroup group-Sequence
20 //!
21 //! Given a finite `Sequence` `xs` with a linearization of `[x1, ..., xm]`
22 //! and a non-negative `IntegralConstant` `n`, `drop_back(xs, n)` is a
23 //! sequence with the same tag as `xs` whose linearization is
24 //! `[x1, ..., xm-n]`. If `n` is not given, it defaults to an
25 //! `IntegralConstant` with a value equal to `1`.
26 //!
27 //! In case `length(xs) <= n`, `drop_back` will simply drop the whole
28 //! sequence without failing, thus returning an empty sequence.
29 //!
30 //!
31 //! @param xs
32 //! The sequence from which elements are dropped.
33 //!
34 //! @param n
35 //! A non-negative `IntegralConstant` representing the number of elements
36 //! to be dropped from the end of the sequence. If `n` is not given, it
37 //! defaults to an `IntegralConstant` with a value equal to `1`.
38 //!
39 //!
40 //! Example
41 //! -------
42 //! @include example/drop_back.cpp
43#ifdef BOOST_HANA_DOXYGEN_INVOKED
44 constexpr auto drop_back = [](auto&& xs[, auto const& n]) {
45 return tag-dispatched;
46 };
47#else
48 template <typename S, typename = void>
49 struct drop_back_impl : drop_back_impl<S, when<true>> { };
50
51 struct drop_back_t {
52 template <typename Xs, typename N>
53 constexpr auto operator()(Xs&& xs, N const& n) const;
54
55 template <typename Xs>
56 constexpr auto operator()(Xs&& xs) const;
57 };
58
59 constexpr drop_back_t drop_back{};
60#endif
61BOOST_HANA_NAMESPACE_END
62
63#endif // !BOOST_HANA_FWD_DROP_BACK_HPP