Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*!
0002 @file
0003 Forward declares `boost::hana::take_while`.
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_TAKE_WHILE_HPP
0011 #define BOOST_HANA_FWD_TAKE_WHILE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Take elements from a sequence while the `predicate` is satisfied.
0019     //! @ingroup group-Sequence
0020     //!
0021     //! Specifically, `take_while` returns a new sequence containing the
0022     //! longest prefix of `xs` in which all the elements satisfy the given
0023     //! predicate.
0024     //!
0025     //!
0026     //! @param xs
0027     //! The sequence to take elements from.
0028     //!
0029     //! @param predicate
0030     //! A function called as `predicate(x)`, where `x` is an element of the
0031     //! sequence, and returning a `Logical` representing whether `x` should be
0032     //! included in the resulting sequence. In the current version of the
0033     //! library, `predicate` has to return a `Constant Logical`.
0034     //!
0035     //!
0036     //! Example
0037     //! -------
0038     //! @include example/take_while.cpp
0039 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0040     constexpr auto take_while = [](auto&& xs, auto&& predicate) {
0041         return tag-dispatched;
0042     };
0043 #else
0044     template <typename S, typename = void>
0045     struct take_while_impl : take_while_impl<S, when<true>> { };
0046 
0047     struct take_while_t {
0048         template <typename Xs, typename Pred>
0049         constexpr auto operator()(Xs&& xs, Pred&& pred) const;
0050     };
0051 
0052     BOOST_HANA_INLINE_VARIABLE constexpr take_while_t take_while{};
0053 #endif
0054 }} // end namespace boost::hana
0055 
0056 #endif // !BOOST_HANA_FWD_TAKE_WHILE_HPP