]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/fwd/back.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / back.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Forward declares `boost::hana::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_BACK_HPP
11#define BOOST_HANA_FWD_BACK_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/when.hpp>
15
16
17BOOST_HANA_NAMESPACE_BEGIN
18 //! Returns the last element of a non-empty and finite iterable.
19 //! @ingroup group-Iterable
20 //!
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
25 //! of `at`).
26 //!
27 //!
28 //! Example
29 //! -------
30 //! @include example/back.cpp
31#ifdef BOOST_HANA_DOXYGEN_INVOKED
32 constexpr auto back = [](auto&& xs) -> decltype(auto) {
33 return tag-dispatched;
34 };
35#else
36 template <typename It, typename = void>
37 struct back_impl : back_impl<It, when<true>> { };
38
39 struct back_t {
40 template <typename Xs>
41 constexpr decltype(auto) operator()(Xs&& xs) const;
42 };
43
44 constexpr back_t back{};
45#endif
46BOOST_HANA_NAMESPACE_END
47
48#endif // !BOOST_HANA_FWD_BACK_HPP