3 Forward declares `boost::hana::front`.
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_FRONT_HPP
11 #define BOOST_HANA_FWD_FRONT_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Returns the first element of a non-empty iterable.
19 //! @ingroup group-Iterable
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`).
30 //! @include example/front.cpp
31 #ifdef BOOST_HANA_DOXYGEN_INVOKED
32 constexpr auto front = [](auto&& xs) -> decltype(auto) {
33 return tag-dispatched;
36 template <typename It, typename = void>
37 struct front_impl : front_impl<It, when<true>> { };
40 template <typename Xs>
41 constexpr decltype(auto) operator()(Xs&& xs) const;
44 constexpr front_t front{};
46 BOOST_HANA_NAMESPACE_END
48 #endif // !BOOST_HANA_FWD_FRONT_HPP