|
|
|||
File indexing completed on 2025-12-15 09:53:05
0001 /*! 0002 @file 0003 Forward declares `boost::hana::replace`. 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_HPP 0011 #define BOOST_HANA_FWD_REPLACE_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 that compare equal 0019 //! to some `value` with some new fixed value. 0020 //! @ingroup group-Functor 0021 //! 0022 //! 0023 //! Signature 0024 //! --------- 0025 //! Given `F` a Functor and `U` a type that can be compared with `T`, 0026 //! the signature is 0027 //! \f$ 0028 //! \mathtt{replace} : F(T) \times U \times T \to F(T) 0029 //! \f$ 0030 //! 0031 //! @param xs 0032 //! The structure to replace elements of. 0033 //! 0034 //! @param oldval 0035 //! An object compared with each element of the structure. Elements 0036 //! of the structure that compare equal to `oldval` are replaced 0037 //! by `newval` in the new structure. 0038 //! 0039 //! @param newval 0040 //! A value by which every element `x` of the structure that compares 0041 //! equal to `oldval` is replaced. 0042 //! 0043 //! 0044 //! Example 0045 //! ------- 0046 //! @include example/replace.cpp 0047 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0048 constexpr auto replace = [](auto&& xs, auto&& oldval, auto&& newval) { 0049 return tag-dispatched; 0050 }; 0051 #else 0052 template <typename Xs, typename = void> 0053 struct replace_impl : replace_impl<Xs, when<true>> { }; 0054 0055 struct replace_t { 0056 template <typename Xs, typename OldVal, typename NewVal> 0057 constexpr auto operator()(Xs&& xs, OldVal&& oldval, NewVal&& newval) const; 0058 }; 0059 0060 BOOST_HANA_INLINE_VARIABLE constexpr replace_t replace{}; 0061 #endif 0062 }} // end namespace boost::hana 0063 0064 #endif // !BOOST_HANA_FWD_REPLACE_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|