3 Forward declares `boost::hana::replace`.
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_HPP
11 #define BOOST_HANA_FWD_REPLACE_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 that compare equal
19 //! to some `value` with some new fixed value.
20 //! @ingroup group-Functor
25 //! Given `F` a Functor and `U` a type that can be compared with `T`,
28 //! \mathtt{replace} : F(T) \times U \times T \to F(T)
32 //! The structure to replace elements of.
35 //! An object compared with each element of the structure. Elements
36 //! of the structure that compare equal to `oldval` are replaced
37 //! by `newval` in the new structure.
40 //! A value by which every element `x` of the structure that compares
41 //! equal to `oldval` is replaced.
46 //! @include example/replace.cpp
47 #ifdef BOOST_HANA_DOXYGEN_INVOKED
48 constexpr auto replace = [](auto&& xs, auto&& oldval, auto&& newval) {
49 return tag-dispatched;
52 template <typename Xs, typename = void>
53 struct replace_impl : replace_impl<Xs, when<true>> { };
56 template <typename Xs, typename OldVal, typename NewVal>
57 constexpr auto operator()(Xs&& xs, OldVal&& oldval, NewVal&& newval) const;
60 constexpr replace_t replace{};
62 BOOST_HANA_NAMESPACE_END
64 #endif // !BOOST_HANA_FWD_REPLACE_HPP