3 Forward declares `boost::hana::take_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_TAKE_BACK_HPP
11 #define BOOST_HANA_FWD_TAKE_BACK_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
19 BOOST_HANA_NAMESPACE_BEGIN
20 //! Returns the last `n` elements of a sequence, or the whole sequence
21 //! if the sequence has less than `n` elements.
22 //! @ingroup group-Sequence
24 //! Given a `Sequence` `xs` and an `IntegralConstant` `n`, `take_back(xs, n)`
25 //! is a new sequence containing the last `n` elements of `xs`, in the
26 //! same order. If `length(xs) <= n`, the whole sequence is returned and
27 //! no error is triggered.
31 //! The sequence to take the elements from.
34 //! A non-negative `IntegralConstant` representing the number of elements
35 //! to keep in the resulting sequence.
40 //! @include example/take_back.cpp
41 #ifdef BOOST_HANA_DOXYGEN_INVOKED
42 constexpr auto take_back = [](auto&& xs, auto const& n) {
43 return tag-dispatched;
46 template <typename S, typename = void>
47 struct take_back_impl : take_back_impl<S, when<true>> { };
50 template <typename Xs, typename N>
51 constexpr auto operator()(Xs&& xs, N const& n) const;
54 constexpr take_back_t take_back{};
56 BOOST_HANA_NAMESPACE_END
58 #endif // !BOOST_HANA_FWD_TAKE_BACK_HPP