mirror of
https://github.com/boostorg/variant.git
synced 2026-07-21 13:43:36 +00:00
Fix tests; Fix copyright; Remove unnecessary mpl::not
This commit is contained in:
@@ -28,8 +28,6 @@
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/type_traits/is_lvalue_reference.hpp>
|
||||
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if defined(BOOST_CLANG)
|
||||
@@ -273,7 +271,7 @@ strict_get(
|
||||
)
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
(mpl::not_< boost::is_lvalue_reference<U> >::value),
|
||||
(!boost::is_lvalue_reference<U>::value),
|
||||
"remove ampersand '&' from template type U in boost::get<U>(boost::variant<T...>&&) "
|
||||
);
|
||||
|
||||
|
||||
@@ -367,19 +367,31 @@ public:
|
||||
|
||||
private:
|
||||
MoveonlyType(const MoveonlyType&);
|
||||
MoveonlyType(MoveonlyType&&);
|
||||
void operator=(const MoveonlyType& other);
|
||||
};
|
||||
|
||||
const boost::variant<int, std::string> foo1() { return ""; }
|
||||
boost::variant<int, std::string> foo2() { return ""; }
|
||||
|
||||
inline void get_rvref_test()
|
||||
{
|
||||
boost::variant<int, MoveonlyType> v;
|
||||
boost::get<std::string>(foo1());
|
||||
boost::get<std::string>(foo2());
|
||||
|
||||
boost::variant<MoveonlyType, int> v;
|
||||
|
||||
v = MoveonlyType();
|
||||
BOOST_CHECK(boost::get<MoveonlyType>(boost::move(v)));
|
||||
BOOST_CHECK(boost::get<MoveonlyType>(v));
|
||||
MoveonlyType&& mt1 = boost::get<MoveonlyType>(boost::move(v));
|
||||
|
||||
boost::relaxed_get<MoveonlyType&>(boost::variant<int, MoveonlyType>()) // Must compile
|
||||
v = 3;
|
||||
|
||||
MoveonlyType moved_from_variant(boost::get<MoveonlyType>(boost::move(x)));
|
||||
v = MoveonlyType();
|
||||
boost::get<MoveonlyType>(v);
|
||||
|
||||
boost::relaxed_get<MoveonlyType&>(boost::variant<MoveonlyType, int>());
|
||||
|
||||
v = MoveonlyType();
|
||||
MoveonlyType moved_from_variant(boost::get<MoveonlyType>(boost::move(v)));
|
||||
}
|
||||
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2014-2017 Antony Polukhin
|
||||
// Copyright (c) 2017-2017 Albert Sverdlov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
Reference in New Issue
Block a user