Re: [Boost-bugs] [Boost C++ Libraries] #13420: small_vector - invalid move constructor/move assignment for size < N

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13420: small_vector - invalid move constructor/move assignment for size < N
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-01-28 21:45:37


#13420: small_vector - invalid move constructor/move assignment for size < N
-------------------------------+--------------------------------
  Reporter: Antervis | Owner: Ion Gaztañaga
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: container
   Version: Boost 1.66.0 | Severity: Problem
Resolution: invalid | Keywords: small_vector, move
-------------------------------+--------------------------------
Changes (by Ion Gaztañaga):

 * status: new => closed
 * resolution: => invalid

Comment:

 I've reviewed some STL implementations, specifically
 operator=(vector&&source), the case when the allocator shall not be
 propagated allocator_traits::propagate_on_container_move_assignment or
 allocators don't compare equal. In those cases memory can't be stolen from
 the source container and elements are move constructed from source to
 destination.

 - libstdc++ clears the source vector
 - libc++ and msvc don't clear the source vector (size is unchanged)

 The standard says for operator=(vector&&) (the move constructor always
 transfers the allocator and does not support different storage types for
 source and destination like small_vector) that *this shall have the same
 value "source" had but no guarantee about the state of "source".

 So I'm reluctant to change the implementation to clear the source. If many
 users find this annoying then we will reopen the issue. Thanks for the
 report.

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13420#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-01-28 21:51:09 UTC