Remove BOOST_NO_CXX11_RVALUE_REFERENCES workarounds

This commit is contained in:
Peter Dimov
2024-01-27 07:21:54 +02:00
parent c9357b6819
commit a9a0f90bc2
3 changed files with 1 additions and 22 deletions

View File

@ -21,11 +21,7 @@
#define BOOST_FUNCTION_TEMPLATE_PARMS typename... T
#define BOOST_FUNCTION_TEMPLATE_ARGS T...
#define BOOST_FUNCTION_PARMS T... a
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
# define BOOST_FUNCTION_ARGS a...
#else
# define BOOST_FUNCTION_ARGS static_cast<T&&>(a)...
#endif
#define BOOST_FUNCTION_ARGS static_cast<T&&>(a)...
// Always have commas (zero args case is handled with variadics too)
#define BOOST_FUNCTION_COMMA ,
@ -710,12 +706,10 @@ namespace boost {
this->assign_to_own(f);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base()
{
this->move_assign(f);
}
#endif
~BOOST_FUNCTION_FUNCTION() { clear(); }
@ -785,7 +779,6 @@ namespace boost {
return *this;
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Move assignment from another BOOST_FUNCTION_FUNCTION
BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f)
{
@ -802,7 +795,6 @@ namespace boost {
BOOST_CATCH_END
return *this;
}
#endif
void swap(BOOST_FUNCTION_FUNCTION& other)
{
@ -1061,11 +1053,9 @@ public:
function(const base_type& f) : base_type(static_cast<const base_type&>(f)){}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Move constructors
function(self_type&& f): base_type(static_cast<base_type&&>(f)){}
function(base_type&& f): base_type(static_cast<base_type&&>(f)){}
#endif
self_type& operator=(const self_type& f)
{
@ -1073,13 +1063,11 @@ public:
return *this;
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
self_type& operator=(self_type&& f)
{
self_type(static_cast<self_type&&>(f)).swap(*this);
return *this;
}
#endif
template<typename Functor>
typename boost::enable_if_<
@ -1103,13 +1091,11 @@ public:
return *this;
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
self_type& operator=(base_type&& f)
{
self_type(static_cast<base_type&&>(f)).swap(*this);
return *this;
}
#endif
};
#undef BOOST_FUNCTION_PARTIAL_SPEC

View File

@ -754,7 +754,6 @@ static void test_move_semantics()
BOOST_CHECK(!f1.empty());
BOOST_CHECK(global_int == 1);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Testing rvalue constructors
f1_type f2(static_cast<f1_type&&>(f1));
BOOST_CHECK(f1.empty());
@ -796,8 +795,6 @@ static void test_move_semantics()
BOOST_CHECK(global_int == 5);
f4 = static_cast<f1_type&&>(f5);
BOOST_CHECK(global_int == 4);
#endif
}
int main()

View File

@ -59,10 +59,8 @@ struct sum_struct {
}
};
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
int three(std::string&&) { return 1; }
std::string&& four(std::string&& s) { return boost::move(s); }
#endif
int main()
{
@ -95,13 +93,11 @@ int main()
BOOST_CHECK(om2_sum_2.get_value() == 3);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
function <int(std::string&&)> f3 = three;
function <std::string&& (std::string&& s)> f4 = four;
f3(std::string("Hello"));
BOOST_CHECK(f4(std::string("world")) == "world");
#endif
return boost::report_errors();
}