3 Forward declares `boost::hana::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_BACK_HPP
11 #define BOOST_HANA_FWD_BACK_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Returns the last element of a non-empty and finite iterable.
19 //! @ingroup group-Iterable
21 //! Given a non-empty and finite iterable `xs` with a linearization of
22 //! `[x1, ..., xN]`, `back(xs)` is equal to `xN`. Equivalently, `back(xs)`
23 //! must be equivalent to `at_c<N-1>(xs)`, and that regardless of the
24 //! value category of `xs` (`back` must respect the reference semantics
30 //! @include example/back.cpp
31 #ifdef BOOST_HANA_DOXYGEN_INVOKED
32 constexpr auto back = [](auto&& xs) -> decltype(auto) {
33 return tag-dispatched;
36 template <typename It, typename = void>
37 struct back_impl : back_impl<It, when<true>> { };
40 template <typename Xs>
41 constexpr decltype(auto) operator()(Xs&& xs) const;
44 constexpr back_t back{};
46 BOOST_HANA_NAMESPACE_END
48 #endif // !BOOST_HANA_FWD_BACK_HPP