mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-18 06:42:13 +02:00
result_of and polymorphic function obj compatibility
[SVN r37962]
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
namespace result_of
|
||||
@ -25,14 +26,13 @@ namespace detail
|
||||
{
|
||||
template <typename Value, typename State>
|
||||
struct apply
|
||||
{
|
||||
typedef typename F::template result<Value, State>::type type;
|
||||
};
|
||||
: boost::result_of<F(Value,State)>
|
||||
{};
|
||||
};
|
||||
|
||||
template <typename Iterator, typename State, typename F>
|
||||
struct fold_apply
|
||||
: mpl::apply<apply_fold_result<F>, typename result_of::value_of<Iterator>::type, State>
|
||||
: boost::result_of<F(typename result_of::value_of<Iterator>::type, State)>
|
||||
{};
|
||||
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
|
@ -43,16 +43,19 @@ namespace boost { namespace fusion { namespace detail
|
||||
replacer(T const& old_value, T const& new_value)
|
||||
: old_value(old_value), new_value(new_value) {}
|
||||
|
||||
template <typename U>
|
||||
struct result
|
||||
template<typename Params>
|
||||
struct result;
|
||||
|
||||
template <typename U1, typename U2>
|
||||
struct result<replacer<U1>(U2)>
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<is_convertible<T, U>, U, U const&>::type
|
||||
mpl::if_<is_convertible<T, U2>, U2, U2 const&>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
typename result<U>::type
|
||||
typename result<replacer(U)>::type
|
||||
operator()(U const& x) const
|
||||
{
|
||||
return replacer_helper<is_convertible<T, U>::value>::
|
||||
|
@ -43,8 +43,11 @@ namespace boost { namespace fusion { namespace detail
|
||||
replacer_if(F f, T const& new_value)
|
||||
: f(f), new_value(new_value) {}
|
||||
|
||||
template <typename U>
|
||||
struct result
|
||||
template<typename Params>
|
||||
struct result;
|
||||
|
||||
template <typename F1, typename T1, typename U>
|
||||
struct result<replacer_if<F1, T1>(U)>
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<is_convertible<T, U>, U, U const&>::type
|
||||
@ -52,7 +55,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
typename result<U>::type
|
||||
typename result<replacer_if(U)>::type
|
||||
operator()(U const& x) const
|
||||
{
|
||||
return replacer_if_helper<is_convertible<T, U>::value>::
|
||||
|
Reference in New Issue
Block a user