mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-13 12:36:30 +02:00
Workaround for some tests on C++11 to allow disambiguation of && and const& arguments to ctors
[SVN r82631]
This commit is contained in:
@ -10,6 +10,10 @@
|
|||||||
#include <boost/fusion/functional/invocation/invoke.hpp>
|
#include <boost/fusion/functional/invocation/invoke.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
#include <functional>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
@ -371,7 +375,17 @@ int main()
|
|||||||
vector0 v0;
|
vector0 v0;
|
||||||
vector1 v1(element1);
|
vector1 v1(element1);
|
||||||
vector2 v2(element1, element2);
|
vector2 v2(element1, element2);
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||||
|
// since we do not have all permutations (expensive!) for all const&
|
||||||
|
// and && arguments. We either have all && or all const& arguments only.
|
||||||
|
// For that matter, use std::ref to disambiguate the call.
|
||||||
|
|
||||||
|
vector3 v3(element1, element2, std::ref(element3));
|
||||||
|
#else
|
||||||
vector3 v3(element1, element2, element3);
|
vector3 v3(element1, element2, element3);
|
||||||
|
#endif
|
||||||
|
|
||||||
test_sequence(v0);
|
test_sequence(v0);
|
||||||
test_sequence(v1);
|
test_sequence(v1);
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
#include <boost/fusion/functional/invocation/invoke_function_object.hpp>
|
#include <boost/fusion/functional/invocation/invoke_function_object.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
#include <functional>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -209,7 +213,17 @@ int main()
|
|||||||
vector0 v0;
|
vector0 v0;
|
||||||
vector1 v1(element1);
|
vector1 v1(element1);
|
||||||
vector2 v2(element1, element2);
|
vector2 v2(element1, element2);
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||||
|
// since we do not have all permutations (expensive!) for all const&
|
||||||
|
// and && arguments. We either have all && or all const& arguments only.
|
||||||
|
// For that matter, use std::ref to disambiguate the call.
|
||||||
|
|
||||||
|
vector3 v3(element1, element2, std::ref(element3));
|
||||||
|
#else
|
||||||
vector3 v3(element1, element2, element3);
|
vector3 v3(element1, element2, element3);
|
||||||
|
#endif
|
||||||
|
|
||||||
test_sequence(v0);
|
test_sequence(v0);
|
||||||
test_sequence(v1);
|
test_sequence(v1);
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
#include <functional>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
@ -256,8 +260,19 @@ int main()
|
|||||||
|
|
||||||
vector0 v0;
|
vector0 v0;
|
||||||
vector1 v1(element1);
|
vector1 v1(element1);
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||||
|
// since we do not have all permutations (expensive!) for all const&
|
||||||
|
// and && arguments. We either have all && or all const& arguments only.
|
||||||
|
// For that matter, use std::ref to disambiguate the call.
|
||||||
|
|
||||||
|
vector2 v2(std::ref(element1), element2);
|
||||||
|
vector3 v3(std::ref(element1), element2, std::ref(element3));
|
||||||
|
#else
|
||||||
vector2 v2(element1, element2);
|
vector2 v2(element1, element2);
|
||||||
vector3 v3(element1, element2, element3);
|
vector3 v3(element1, element2, element3);
|
||||||
|
#endif
|
||||||
|
|
||||||
test_sequence(v0);
|
test_sequence(v0);
|
||||||
test_sequence(v1);
|
test_sequence(v1);
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
#include <functional>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(FUSION_AT)
|
#if !defined(FUSION_AT)
|
||||||
#define FUSION_AT at_c
|
#define FUSION_AT at_c
|
||||||
#endif
|
#endif
|
||||||
@ -35,7 +39,16 @@ test()
|
|||||||
|
|
||||||
double d = 2.7;
|
double d = 2.7;
|
||||||
A a;
|
A a;
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||||
|
// since we do not have all permutations (expensive!) for all const&
|
||||||
|
// and && arguments. We either have all && or all const& arguments only.
|
||||||
|
// For that matter, use std::ref to disambiguate the call.
|
||||||
|
|
||||||
|
FUSION_SEQUENCE<int, double&, const A&, int> t(1, std::ref(d), a, 2);
|
||||||
|
#else
|
||||||
FUSION_SEQUENCE<int, double&, const A&, int> t(1, d, a, 2);
|
FUSION_SEQUENCE<int, double&, const A&, int> t(1, d, a, 2);
|
||||||
|
#endif
|
||||||
const FUSION_SEQUENCE<int, double&, const A, int> ct(t);
|
const FUSION_SEQUENCE<int, double&, const A, int> ct(t);
|
||||||
|
|
||||||
int i = FUSION_AT<0>(t);
|
int i = FUSION_AT<0>(t);
|
||||||
|
Reference in New Issue
Block a user