#8764 closed Feature Requests (fixed)
Improve traits of Boost.Move
Reported by: | Antony Polukhin | Owned by: | Ion Gaztañaga |
---|---|---|---|
Milestone: | Boost 1.55.0 | Component: | move |
Version: | Boost 1.54.0 | Severity: | Regression |
Keywords: | Cc: |
Description
Since boost 1.54.0 we have the following traits:
has_trivial_move_assign has_trivial_move_constructor is_nothrow_move_assignable is_nothrow_move_constructible
It means that has_nothrow_move
trait in boost/move/traits.cpp
can be improved.
Change History (4)
comment:1 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
I'm afraid that the improved trait breaks one of the tests in libs/move/test/move.hpp
.
Following assert:
BOOST_STATIC_ASSERT((boost::has_nothrow_move<copyable>::value == false));
will be failing now. According to C++11 Standard is_nothrow_move_constructible
evaluates to true
if the following code does not throw:
copyable var(std::move(nonconst_copyable_variable))
Such code does not throw even if the copyable
has no move constructor, but has a nothrow copy constructor.
Following solution could be used to fix tests:
// Attempt to move construct `copyable` type won't throw exceptions in C++03 and C++11 BOOST_STATIC_ASSERT((boost::has_nothrow_move<copyable>::value == true));
follow-up: 4 comment:3 by , 9 years ago
I think that would fix the test only for compilers that can deduce it won't throw. I think we should delete that line as we don't know what the compiler will deduce.
comment:4 by , 9 years ago
Replying to igaztanaga:
I think that would fix the test only for compilers that can deduce it won't throw. I think we should delete that line as we don't know what the compiler will deduce.
I agree. is_nothrow_move_assignable
and is_nothrow_move_constructible
traits are covered by tests in Boost.TypeTraits. Test in Boost.Move mainly duplicates those.
Fixed in revision 85182