mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-21 16:22:45 +02:00
Fusion: fixed another const correctness problem
[SVN r56383]
This commit is contained in:
@ -31,7 +31,7 @@ namespace boost { namespace fusion
|
|||||||
struct result;
|
struct result;
|
||||||
|
|
||||||
template<typename U>
|
template<typename U>
|
||||||
struct result<addref(U)> : boost::add_reference<U> {};
|
struct result<addref(U)> : add_reference<U> {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename boost::result_of<addref(T)>::type
|
typename boost::result_of<addref(T)>::type
|
||||||
@ -40,6 +40,24 @@ namespace boost { namespace fusion
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct addconstref
|
||||||
|
{
|
||||||
|
template<typename Sig>
|
||||||
|
struct result;
|
||||||
|
|
||||||
|
template<typename U>
|
||||||
|
struct result<addconstref(U)>
|
||||||
|
: add_reference<typename add_const<U>::type>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
typename boost::result_of<addconstref(T)>::type
|
||||||
|
operator()(T& x) const
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nview_tag;
|
struct nview_tag;
|
||||||
@ -58,12 +76,15 @@ namespace boost { namespace fusion
|
|||||||
typedef Indicies index_type;
|
typedef Indicies index_type;
|
||||||
typedef typename mpl::size<Indicies>::type size;
|
typedef typename mpl::size<Indicies>::type size;
|
||||||
|
|
||||||
typedef transform_view<Sequence, detail::addref> transform_view_type;
|
typedef typename mpl::if_<
|
||||||
|
is_const<Sequence>, detail::addconstref, detail::addref
|
||||||
|
>::type transform_type;
|
||||||
|
typedef transform_view<Sequence, transform_type> transform_view_type;
|
||||||
typedef typename result_of::as_vector<transform_view_type>::type
|
typedef typename result_of::as_vector<transform_view_type>::type
|
||||||
sequence_type;
|
sequence_type;
|
||||||
|
|
||||||
explicit nview(Sequence& val)
|
explicit nview(Sequence& val)
|
||||||
: seq(as_vector(transform_view_type(val, detail::addref())))
|
: seq(sequence_type(transform_view_type(val, transform_type())))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
sequence_type seq;
|
sequence_type seq;
|
||||||
|
Reference in New Issue
Block a user