3 Forward declares `boost::hana::drop_back`.
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)
10 #ifndef BOOST_HANA_FWD_DROP_BACK_HPP
11 #define BOOST_HANA_FWD_DROP_BACK_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Drop the last `n` elements of a finite sequence, and return the rest.
19 //! @ingroup group-Sequence
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`.
27 //! In case `length(xs) <= n`, `drop_back` will simply drop the whole
28 //! sequence without failing, thus returning an empty sequence.
32 //! The sequence from which elements are dropped.
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`.
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;
48 template <typename S, typename = void>
49 struct drop_back_impl : drop_back_impl<S, when<true>> { };
52 template <typename Xs, typename N>
53 constexpr auto operator()(Xs&& xs, N const& n) const;
55 template <typename Xs>
56 constexpr auto operator()(Xs&& xs) const;
59 constexpr drop_back_t drop_back{};
61 BOOST_HANA_NAMESPACE_END
63 #endif // !BOOST_HANA_FWD_DROP_BACK_HPP