Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:04

0001 /*!
0002 @file
0003 Forward declares `boost::hana::front`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_FWD_FRONT_HPP
0011 #define BOOST_HANA_FWD_FRONT_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Returns the first element of a non-empty iterable.
0019     //! @ingroup group-Iterable
0020     //!
0021     //! Given a non-empty Iterable `xs` with a linearization of `[x1, ..., xN]`,
0022     //! `front(xs)` is equal to `x1`. If `xs` is empty, it is an error to
0023     //! use this function. Equivalently, `front(xs)` must be equivalent to
0024     //! `at_c<0>(xs)`, and that regardless of the value category of `xs`
0025     //! (`front` must respect the reference semantics of `at`).
0026     //!
0027     //!
0028     //! Example
0029     //! -------
0030     //! @include example/front.cpp
0031 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0032     constexpr auto front = [](auto&& xs) -> decltype(auto) {
0033         return tag-dispatched;
0034     };
0035 #else
0036     template <typename It, typename = void>
0037     struct front_impl : front_impl<It, when<true>> { };
0038 
0039     struct front_t {
0040         template <typename Xs>
0041         constexpr decltype(auto) operator()(Xs&& xs) const;
0042     };
0043 
0044     BOOST_HANA_INLINE_VARIABLE constexpr front_t front{};
0045 #endif
0046 }} // end namespace boost::hana
0047 
0048 #endif // !BOOST_HANA_FWD_FRONT_HPP