forked from boostorg/fusion
C++11 patches by Michel Morin
[SVN r75394]
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <boost/fusion/support/deduce.hpp>
|
||||
#include <boost/fusion/container/vector/convert.hpp>
|
||||
#include <boost/fusion/view/transform_view.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace fusion { namespace traits
|
||||
@ -29,6 +30,13 @@ namespace boost { namespace fusion { namespace traits
|
||||
struct result< Self(T) >
|
||||
: fusion::traits::deduce<T>
|
||||
{ };
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template <typename T>
|
||||
typename result< deducer(T) >::type
|
||||
operator()(T&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#if !defined(FUSION_STRICTEST_TRAVERSAL_20060123_2101)
|
||||
#define FUSION_STRICTEST_TRAVERSAL_20060123_2101
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
@ -53,6 +54,13 @@ namespace boost { namespace fusion
|
||||
|
||||
typedef typename stricter_traversal<tag1,tag2>::type type;
|
||||
};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename StrictestSoFar, typename Next>
|
||||
typename result<strictest_traversal_impl(StrictestSoFar, Next)>::type
|
||||
operator()(StrictestSoFar&&, Next&&) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
#include <boost/fusion/view/transform_view.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace detail
|
||||
@ -35,12 +37,21 @@ namespace boost { namespace fusion
|
||||
template<typename U>
|
||||
struct result<addref(U)> : add_reference<U> {};
|
||||
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
template <typename T>
|
||||
typename add_reference<T>::type
|
||||
operator()(T& x) const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
template <typename T>
|
||||
typename result<addref(T)>::type
|
||||
operator()(T&& x) const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct addconstref
|
||||
|
@ -62,7 +62,7 @@ namespace boost { namespace fusion {
|
||||
|
||||
template<typename Seq>
|
||||
typename result<endpoints(Seq const&)>::type
|
||||
operator()(Seq const& seq)
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::advance<M>(fusion::begin(seq));
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
@ -35,6 +36,13 @@ namespace boost { namespace fusion {
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_at<typename remove_reference<Seq>::type, N> >
|
||||
{};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename Seq>
|
||||
typename result<poly_value_at(Seq)>::type
|
||||
operator()(Seq&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -34,6 +35,13 @@ namespace boost { namespace fusion
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_of<It> >
|
||||
{};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename It>
|
||||
typename result<poly_value_of(It)>::type
|
||||
operator()(It&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace detail
|
||||
@ -64,6 +66,13 @@ namespace boost { namespace fusion {
|
||||
result_of::size<SeqClass>,
|
||||
mpl::int_<high_int> >::type type;
|
||||
};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename Seq>
|
||||
typename result<seq_ref_size(Seq)>::type
|
||||
operator()(Seq&&) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct poly_min
|
||||
@ -78,6 +87,13 @@ namespace boost { namespace fusion {
|
||||
typedef typename remove_reference<Rhs>::type rhs;
|
||||
typedef typename mpl::min<lhs, rhs>::type type;
|
||||
};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename Lhs, typename Rhs>
|
||||
typename result<poly_min(Lhs, Rhs)>::type
|
||||
operator()(Lhs&&, Rhs&&) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Sequences>
|
||||
|
@ -72,6 +72,8 @@ struct fobj
|
||||
|
||||
int operator()(int i, object &, object_nc &) { return 10 + i; }
|
||||
int operator()(int i, object &, object_nc &) const { return 11 + i; }
|
||||
int operator()(int i, object const &, object_nc &);
|
||||
int operator()(int i, object const &, object_nc &) const;
|
||||
};
|
||||
|
||||
struct nullary_fobj
|
||||
|
@ -75,6 +75,8 @@ struct fobj
|
||||
|
||||
int operator()(int i, object &, object_nc &) { return 10 + i; }
|
||||
int operator()(int i, object &, object_nc &) const { return 11 + i; }
|
||||
int operator()(int i, object const &, object_nc &);
|
||||
int operator()(int i, object const &, object_nc &) const;
|
||||
};
|
||||
|
||||
struct nullary_fobj
|
||||
|
@ -71,7 +71,7 @@ void result_type_tests()
|
||||
|
||||
typedef fusion::unfused< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int &) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -85,7 +85,7 @@ void result_type_tests()
|
||||
typedef fusion::unfused_typed< test_func<>, types0 > t0;
|
||||
BOOST_TEST(( is_same< boost::result_of< t0 () >::type, long >::value ));
|
||||
typedef fusion::unfused_typed< test_func<>, types1 > t1;
|
||||
BOOST_TEST(( is_same< boost::result_of< t1 (int) >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t1 (long &) >::type, long >::value ));
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC < 1400
|
||||
|
Reference in New Issue
Block a user