Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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.

Attachments (0)

Change History (4)

comment:1 Changed 4 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Fixed in revision 85182

comment:2 Changed 4 years ago by Antony Polukhin

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));

comment:3 Changed 4 years ago by Ion Gaztañaga

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 in reply to:  3 Changed 4 years ago by Antony Polukhin

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.