diff --git a/include/boost/fusion/support/deduce_sequence.hpp b/include/boost/fusion/support/deduce_sequence.hpp index 77631b79..ce02a3cd 100644 --- a/include/boost/fusion/support/deduce_sequence.hpp +++ b/include/boost/fusion/support/deduce_sequence.hpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace boost { namespace fusion { namespace traits @@ -29,6 +30,13 @@ namespace boost { namespace fusion { namespace traits struct result< Self(T) > : fusion::traits::deduce { }; + + // never called, but needed for decltype-based result_of (C++0x) +#ifndef BOOST_NO_RVALUE_REFERENCES + template + typename result< deducer(T) >::type + operator()(T&&) const; +#endif }; } diff --git a/include/boost/fusion/view/detail/strictest_traversal.hpp b/include/boost/fusion/view/detail/strictest_traversal.hpp index 39a389c3..7b7c9760 100644 --- a/include/boost/fusion/view/detail/strictest_traversal.hpp +++ b/include/boost/fusion/view/detail/strictest_traversal.hpp @@ -8,6 +8,7 @@ #if !defined(FUSION_STRICTEST_TRAVERSAL_20060123_2101) #define FUSION_STRICTEST_TRAVERSAL_20060123_2101 +#include #include #include #include @@ -53,6 +54,13 @@ namespace boost { namespace fusion typedef typename stricter_traversal::type type; }; + + // never called, but needed for decltype-based result_of (C++0x) +#ifndef BOOST_NO_RVALUE_REFERENCES + template + typename result::type + operator()(StrictestSoFar&&, Next&&) const; +#endif }; template diff --git a/include/boost/fusion/view/nview/nview.hpp b/include/boost/fusion/view/nview/nview.hpp index 02422e0b..2355b688 100644 --- a/include/boost/fusion/view/nview/nview.hpp +++ b/include/boost/fusion/view/nview/nview.hpp @@ -23,6 +23,8 @@ #include #include +#include + namespace boost { namespace fusion { namespace detail @@ -35,12 +37,21 @@ namespace boost { namespace fusion template struct result : add_reference {}; +#ifdef BOOST_NO_RVALUE_REFERENCES template typename add_reference::type operator()(T& x) const { return x; } +#else + template + typename result::type + operator()(T&& x) const + { + return x; + } +#endif }; struct addconstref diff --git a/include/boost/fusion/view/zip_view/detail/end_impl.hpp b/include/boost/fusion/view/zip_view/detail/end_impl.hpp index b58854e3..6423a88f 100644 --- a/include/boost/fusion/view/zip_view/detail/end_impl.hpp +++ b/include/boost/fusion/view/zip_view/detail/end_impl.hpp @@ -62,7 +62,7 @@ namespace boost { namespace fusion { template typename result::type - operator()(Seq const& seq) + operator()(Seq const& seq) const { return fusion::advance(fusion::begin(seq)); } diff --git a/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp b/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp index 93f0979b..13e0274f 100644 --- a/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp +++ b/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace boost { namespace fusion { @@ -35,6 +36,13 @@ namespace boost { namespace fusion { mpl::identity, result_of::value_at::type, N> > {}; + + // never called, but needed for decltype-based result_of (C++0x) +#ifndef BOOST_NO_RVALUE_REFERENCES + template + typename result::type + operator()(Seq&&) const; +#endif }; } diff --git a/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp b/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp index 45b7b962..5571155e 100644 --- a/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp +++ b/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace boost { namespace fusion { @@ -34,6 +35,13 @@ namespace boost { namespace fusion mpl::identity, result_of::value_of > {}; + + // never called, but needed for decltype-based result_of (C++0x) +#ifndef BOOST_NO_RVALUE_REFERENCES + template + typename result::type + operator()(It&&) const; +#endif }; } diff --git a/include/boost/fusion/view/zip_view/zip_view.hpp b/include/boost/fusion/view/zip_view/zip_view.hpp index 6258711c..e9a0222d 100644 --- a/include/boost/fusion/view/zip_view/zip_view.hpp +++ b/include/boost/fusion/view/zip_view/zip_view.hpp @@ -37,6 +37,8 @@ #include #include +#include + namespace boost { namespace fusion { namespace detail @@ -64,6 +66,13 @@ namespace boost { namespace fusion { result_of::size, mpl::int_ >::type type; }; + + // never called, but needed for decltype-based result_of (C++0x) +#ifndef BOOST_NO_RVALUE_REFERENCES + template + typename result::type + operator()(Seq&&) const; +#endif }; struct poly_min @@ -78,6 +87,13 @@ namespace boost { namespace fusion { typedef typename remove_reference::type rhs; typedef typename mpl::min::type type; }; + + // never called, but needed for decltype-based result_of (C++0x) +#ifndef BOOST_NO_RVALUE_REFERENCES + template + typename result::type + operator()(Lhs&&, Rhs&&) const; +#endif }; template diff --git a/test/functional/invoke.cpp b/test/functional/invoke.cpp index 52740eec..f326cbd8 100644 --- a/test/functional/invoke.cpp +++ b/test/functional/invoke.cpp @@ -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 diff --git a/test/functional/invoke_function_object.cpp b/test/functional/invoke_function_object.cpp index 31357aa8..7cbe6e59 100644 --- a/test/functional/invoke_function_object.cpp +++ b/test/functional/invoke_function_object.cpp @@ -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 diff --git a/test/functional/unfused.cpp b/test/functional/unfused.cpp index 27a242a6..bde9b95b 100644 --- a/test/functional/unfused.cpp +++ b/test/functional/unfused.cpp @@ -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() diff --git a/test/functional/unfused_typed.cpp b/test/functional/unfused_typed.cpp index 85783c86..93c35b6d 100644 --- a/test/functional/unfused_typed.cpp +++ b/test/functional/unfused_typed.cpp @@ -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