mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-12 03:56:30 +02:00
fusion: merge of associative iterators/views and the new fold interface
[SVN r58618]
This commit is contained in:
@ -34,22 +34,22 @@ struct add_ints_only
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template <typename T, typename State>
|
||||
struct result<add_ints_only(T,State)>
|
||||
template <typename State, typename T>
|
||||
struct result<add_ints_only(State, T)>
|
||||
{
|
||||
typedef typename boost::remove_const<
|
||||
typename boost::remove_reference<State>::type>::type type;
|
||||
};
|
||||
|
||||
template <typename T, typename State>
|
||||
State const&
|
||||
operator()(T const& x, State const& state) const
|
||||
template <typename State, typename T>
|
||||
State
|
||||
operator()(State const& state, T const& x) const
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
int
|
||||
operator()(int x, int state) const
|
||||
operator()(int state, int x) const
|
||||
{
|
||||
return x + state;
|
||||
}
|
||||
@ -60,13 +60,13 @@ struct count_ints
|
||||
template<typename T>
|
||||
struct result;
|
||||
|
||||
template <typename T, typename CountT>
|
||||
struct result<count_ints(T,CountT)>
|
||||
template <typename CountT, typename T>
|
||||
struct result<count_ints(CountT, T)>
|
||||
{
|
||||
typedef typename boost::remove_const<
|
||||
typename boost::remove_reference<T>::type>::type elem;
|
||||
typedef typename boost::remove_const<
|
||||
typename boost::remove_reference<CountT>::type>::type state;
|
||||
typedef typename boost::remove_const<
|
||||
typename boost::remove_reference<T>::type>::type elem;
|
||||
|
||||
typedef typename
|
||||
if_<
|
||||
@ -77,11 +77,11 @@ struct count_ints
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename T, typename CountT>
|
||||
typename result<count_ints(T, CountT)>::type
|
||||
operator()(T const&, CountT const&) const
|
||||
template <typename CountT, typename T>
|
||||
typename result<count_ints(CountT, T)>::type
|
||||
operator()(CountT const&, T const&) const
|
||||
{
|
||||
typedef typename result<count_ints(T, CountT)>::type result;
|
||||
typedef typename result<count_ints(CountT, T)>::type result;
|
||||
return result();
|
||||
}
|
||||
};
|
||||
@ -90,7 +90,7 @@ struct appender
|
||||
{
|
||||
typedef std::string result_type;
|
||||
|
||||
std::string operator()(char c, std::string const& str) const
|
||||
std::string operator()(std::string const& str, char c) const
|
||||
{
|
||||
return str + c;
|
||||
}
|
||||
@ -102,14 +102,14 @@ struct lvalue_adder
|
||||
struct result;
|
||||
|
||||
template<typename T0, typename T1>
|
||||
struct result<lvalue_adder(T0&, T1)>
|
||||
struct result<lvalue_adder(T0, T1&)>
|
||||
{
|
||||
// Second argument still needs to support rvalues - see definition of fusion::fold
|
||||
typedef T0 type;
|
||||
typedef T1 type;
|
||||
};
|
||||
|
||||
template<typename T0, typename T1>
|
||||
T0 operator()(T0& lhs, T1 const& rhs) const
|
||||
T1 operator()(T0 const& lhs, T1& rhs) const
|
||||
{
|
||||
return lhs + rhs;
|
||||
}
|
||||
|
Reference in New Issue
Block a user