File indexing completed on 2025-01-18 09:31:17
0001
0002
0003
0004
0005
0006
0007 #if !defined(FUSION_REPLACE_IF_08182005_0939)
0008 #define FUSION_REPLACE_IF_08182005_0939
0009
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/view/transform_view/transform_view.hpp>
0012 #include <boost/fusion/algorithm/transformation/detail/replace_if.hpp>
0013 #include <boost/fusion/support/is_sequence.hpp>
0014 #include <boost/utility/enable_if.hpp>
0015 #include <boost/type_traits/is_same.hpp>
0016
0017 namespace boost { namespace fusion
0018 {
0019 namespace result_of
0020 {
0021 template <typename Sequence, typename F, typename T>
0022 struct replace_if
0023 {
0024 typedef transform_view<Sequence, detail::replacer_if<F, T> > type;
0025 };
0026 }
0027
0028 template <typename Sequence, typename F, typename T>
0029 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0030 inline typename
0031 enable_if<
0032 traits::is_sequence<Sequence>
0033 , typename result_of::replace_if<Sequence const, F, T>::type
0034 >::type
0035 replace_if(Sequence const& seq, F pred, T const& new_value)
0036 {
0037 typedef typename result_of::replace_if<Sequence const, F, T>::type result;
0038 detail::replacer_if<F, T> f(pred, new_value);
0039 return result(seq, f);
0040 }
0041 }}
0042
0043 #endif
0044