3 Forward declares `boost::hana::drop_front`.
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)
10 #ifndef BOOST_HANA_FWD_DROP_FRONT_HPP
11 #define BOOST_HANA_FWD_DROP_FRONT_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Drop the first `n` elements of an iterable, and return the rest.
19 //! @ingroup group-Iterable
21 //! Given an `Iterable` `xs` with a linearization of `[x1, x2, ...]` and
22 //! a non-negative `IntegralConstant` `n`, `drop_front(xs, n)` is an
23 //! 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`.
28 //! In case `length(xs) <= n`, `drop_front` will simply drop the whole
29 //! iterable without failing, thus returning an empty iterable. This is
30 //! different from `drop_front_exactly`, which expects `n <= length(xs)`
31 //! but can be better optimized because of this additional guarantee.
35 //! The iterable from which elements are dropped.
38 //! A non-negative `IntegralConstant` representing the number of elements
39 //! to be dropped from the iterable. If `n` is not given, it defaults to
40 //! an `IntegralConstant` with a value equal to `1`.
45 //! @include example/drop_front.cpp
46 #ifdef BOOST_HANA_DOXYGEN_INVOKED
47 constexpr auto drop_front = [](auto&& xs[, auto const& n]) {
48 return tag-dispatched;
51 template <typename It, typename = void>
52 struct drop_front_impl : drop_front_impl<It, when<true>> { };
55 template <typename Xs, typename N>
56 constexpr auto operator()(Xs&& xs, N const& n) const;
58 template <typename Xs>
59 constexpr auto operator()(Xs&& xs) const;
62 constexpr drop_front_t drop_front{};
64 BOOST_HANA_NAMESPACE_END
66 #endif // !BOOST_HANA_FWD_DROP_FRONT_HPP