]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*! |
2 | @file | |
3 | Forward declares `boost::hana::drop_while`. | |
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_DROP_WHILE_HPP | |
11 | #define BOOST_HANA_FWD_DROP_WHILE_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/core/when.hpp> | |
15 | ||
16 | ||
17 | BOOST_HANA_NAMESPACE_BEGIN | |
18 | //! Drop elements from an iterable up to, but excluding, the first | |
19 | //! element for which the `predicate` is not satisfied. | |
20 | //! @ingroup group-Iterable | |
21 | //! | |
22 | //! Specifically, `drop_while` returns an iterable containing all the | |
23 | //! elements of the original iterable except for those in the range | |
24 | //! delimited by [`head`, `e`), where `head` is the first element and | |
25 | //! `e` is the first element for which the `predicate` is not satisfied. | |
26 | //! If the iterable is not finite, the `predicate` has to return a false- | |
27 | //! valued `Logical` at a finite index for this method to return. | |
28 | //! | |
29 | //! | |
30 | //! @param iterable | |
31 | //! The iterable from which elements are dropped. | |
32 | //! | |
33 | //! @param predicate | |
34 | //! A function called as `predicate(x)`, where `x` is an element of the | |
35 | //! structure, and returning a `Logical` representing whether `x` should | |
36 | //! be dropped from the structure. In the current version of the library, | |
37 | //! `predicate` should return a compile-time `Logical`. | |
38 | //! | |
39 | //! | |
40 | //! Example | |
41 | //! ------- | |
42 | //! @include example/drop_while.cpp | |
43 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
44 | constexpr auto drop_while = [](auto&& iterable, auto&& predicate) { | |
45 | return tag-dispatched; | |
46 | }; | |
47 | #else | |
48 | template <typename It, typename = void> | |
49 | struct drop_while_impl : drop_while_impl<It, when<true>> { }; | |
50 | ||
51 | struct drop_while_t { | |
52 | template <typename Xs, typename Pred> | |
53 | constexpr auto operator()(Xs&& xs, Pred&& pred) const; | |
54 | }; | |
55 | ||
56 | constexpr drop_while_t drop_while{}; | |
57 | #endif | |
58 | BOOST_HANA_NAMESPACE_END | |
59 | ||
60 | #endif // !BOOST_HANA_FWDDROP_WHILE_HPP |