forked from boostorg/fusion
[identity_view] Fix for spoiled prvalue
This commit is contained in:
@ -10,18 +10,34 @@
|
|||||||
#include <boost/fusion/support/config.hpp>
|
#include <boost/fusion/support/config.hpp>
|
||||||
#include <boost/fusion/view/transform_view.hpp>
|
#include <boost/fusion/view/transform_view.hpp>
|
||||||
#include <boost/functional/identity.hpp>
|
#include <boost/functional/identity.hpp>
|
||||||
|
#include <boost/utility/result_of.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
namespace detail {
|
||||||
|
struct identity : boost::identity
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
template<typename T>
|
||||||
|
struct result_of<fusion::detail::identity(T)>
|
||||||
|
{
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
namespace boost { namespace fusion {
|
namespace boost { namespace fusion {
|
||||||
template<typename Sequence> struct identity_view
|
template<typename Sequence> struct identity_view
|
||||||
: transform_view<Sequence, boost::identity>
|
: transform_view<Sequence, detail::identity>
|
||||||
{
|
{
|
||||||
typedef transform_view<Sequence, boost::identity> base_type;
|
typedef transform_view<Sequence, detail::identity> base_type;
|
||||||
|
|
||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
identity_view(Sequence& in_seq)
|
identity_view(Sequence& in_seq)
|
||||||
: base_type(in_seq, boost::identity()) {}
|
: base_type(in_seq, detail::identity()) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,7 +77,7 @@ main()
|
|||||||
|
|
||||||
BOOST_TEST((*boost::fusion::advance_c<3>(boost::fusion::begin(xform)) == 8));
|
BOOST_TEST((*boost::fusion::advance_c<3>(boost::fusion::begin(xform)) == 8));
|
||||||
BOOST_TEST((boost::fusion::at_c<2>(xform) == 7));
|
BOOST_TEST((boost::fusion::at_c<2>(xform) == 7));
|
||||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<xform_type, 0>::type, boost::mpl::integral_c<int, 5>&& >));
|
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<xform_type, 0>::type, boost::mpl::integral_c<int, 5> >));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -153,10 +153,9 @@ main()
|
|||||||
typedef boost::fusion::result_of::next<first>::type second;
|
typedef boost::fusion::result_of::next<first>::type second;
|
||||||
typedef boost::fusion::result_of::next<second>::type third;
|
typedef boost::fusion::result_of::next<second>::type third;
|
||||||
|
|
||||||
// TODO: why is a boost::fusion::pair<int, char>&& ??
|
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<first>::type, boost::fusion::pair<int, char> >));
|
||||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<first>::type, boost::fusion::pair<int, char>&& >));
|
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<second>::type, boost::fusion::pair<double, std::string> >));
|
||||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<second>::type, boost::fusion::pair<double, std::string>&& >));
|
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<third>::type, boost::fusion::pair<abstract, int> >));
|
||||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<third>::type, boost::fusion::pair<abstract, int>&& >));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user