3 Forward declares `boost::hana::replace_if`.
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_REPLACE_IF_HPP
11 #define BOOST_HANA_FWD_REPLACE_IF_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Replace all the elements of a structure satisfying a `predicate`
19 //! with a fixed value.
20 //! @ingroup group-Functor
25 //! Given `F` a Functor and `Bool` a Logical, the signature is
27 //! \mathtt{replace_if} : F(T) \times (T \to Bool) \times T \to F(T)
31 //! The structure to replace elements of.
34 //! A function called as `predicate(x)` for element(s) `x` of the
35 //! structure and returning a `Logical` representing whether `x`
36 //! should be replaced by `value`.
39 //! A value by which every element `x` of the structure for which
40 //! `predicate` returns a true-valued `Logical` is replaced.
45 //! @include example/replace_if.cpp
46 #ifdef BOOST_HANA_DOXYGEN_INVOKED
47 constexpr auto replace_if = [](auto&& xs, auto&& predicate, auto&& value) {
48 return tag-dispatched;
51 template <typename Xs, typename = void>
52 struct replace_if_impl : replace_if_impl<Xs, when<true>> { };
55 template <typename Xs, typename Pred, typename Value>
56 constexpr auto operator()(Xs&& xs, Pred&& pred, Value&& value) const;
59 constexpr replace_if_t replace_if{};
61 BOOST_HANA_NAMESPACE_END
63 #endif // !BOOST_HANA_FWD_REPLACE_IF_HPP