]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/include/boost/hana/fwd/front.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / front.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::front`.
4
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)
8 */
9
10 #ifndef BOOST_HANA_FWD_FRONT_HPP
11 #define BOOST_HANA_FWD_FRONT_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Returns the first element of a non-empty iterable.
19 //! @ingroup group-Iterable
20 //!
21 //! Given a non-empty Iterable `xs` with a linearization of `[x1, ..., xN]`,
22 //! `front(xs)` is equal to `x1`. If `xs` is empty, it is an error to
23 //! use this function. Equivalently, `front(xs)` must be equivalent to
24 //! `at_c<0>(xs)`, and that regardless of the value category of `xs`
25 //! (`front` must respect the reference semantics of `at`).
26 //!
27 //!
28 //! Example
29 //! -------
30 //! @include example/front.cpp
31 #ifdef BOOST_HANA_DOXYGEN_INVOKED
32 constexpr auto front = [](auto&& xs) -> decltype(auto) {
33 return tag-dispatched;
34 };
35 #else
36 template <typename It, typename = void>
37 struct front_impl : front_impl<It, when<true>> { };
38
39 struct front_t {
40 template <typename Xs>
41 constexpr decltype(auto) operator()(Xs&& xs) const;
42 };
43
44 constexpr front_t front{};
45 #endif
46 BOOST_HANA_NAMESPACE_END
47
48 #endif // !BOOST_HANA_FWD_FRONT_HPP