|
|
|||
File indexing completed on 2025-12-15 09:53:05
0001 /*! 0002 @file 0003 Forward declares `boost::hana::replace_if`. 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_REPLACE_IF_HPP 0011 #define BOOST_HANA_FWD_REPLACE_IF_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 0016 0017 namespace boost { namespace hana { 0018 //! Replace all the elements of a structure satisfying a `predicate` 0019 //! with a fixed value. 0020 //! @ingroup group-Functor 0021 //! 0022 //! 0023 //! Signature 0024 //! --------- 0025 //! Given `F` a Functor and `Bool` a Logical, the signature is 0026 //! \f$ 0027 //! \mathtt{replace\_if} : F(T) \times (T \to Bool) \times T \to F(T) 0028 //! \f$ 0029 //! 0030 //! @param xs 0031 //! The structure to replace elements of. 0032 //! 0033 //! @param predicate 0034 //! A function called as `predicate(x)` for element(s) `x` of the 0035 //! structure and returning a `Logical` representing whether `x` 0036 //! should be replaced by `value`. 0037 //! 0038 //! @param value 0039 //! A value by which every element `x` of the structure for which 0040 //! `predicate` returns a true-valued `Logical` is replaced. 0041 //! 0042 //! 0043 //! Example 0044 //! ------- 0045 //! @include example/replace_if.cpp 0046 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0047 constexpr auto replace_if = [](auto&& xs, auto&& predicate, auto&& value) { 0048 return tag-dispatched; 0049 }; 0050 #else 0051 template <typename Xs, typename = void> 0052 struct replace_if_impl : replace_if_impl<Xs, when<true>> { }; 0053 0054 struct replace_if_t { 0055 template <typename Xs, typename Pred, typename Value> 0056 constexpr auto operator()(Xs&& xs, Pred&& pred, Value&& value) const; 0057 }; 0058 0059 BOOST_HANA_INLINE_VARIABLE constexpr replace_if_t replace_if{}; 0060 #endif 0061 }} // end namespace boost::hana 0062 0063 #endif // !BOOST_HANA_FWD_REPLACE_IF_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|