/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_REPLACE_08182005_0841) #define FUSION_REPLACE_08182005_0841 #include #include #include #include namespace boost { namespace fusion { namespace detail { template struct replacer_helper; template <> struct replacer_helper { template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static U& call(U& x, T const&, T const&) { return x; } }; template <> struct replacer_helper { template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static U call(U& x, T const& old_value, T const& new_value) { return (x == old_value) ? new_value : x; } }; template struct replacer { BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED replacer(T const& in_old_value, T const& in_new_value) : old_value(in_old_value), new_value(in_new_value) {} template struct result; template struct result(U2)> { typedef typename remove_reference::type value; typedef typename mpl::if_, value, value const&>::type type; }; template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename result::type operator()(U const& x) const { return replacer_helper::value>:: call(x, old_value, new_value); } T old_value; T new_value; }; }}} #endif