C++ Logo

std-discussion

Advanced search

Re: On "transparently replaceable" in std::vector operations

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Wed, 28 Apr 2021 10:01:29 +0100
On Wed, 28 Apr 2021 at 09:53, Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
wrote:

> Il 28/04/21 10:40, Edward Catmur ha scritto:
> > Consider a T that is (CopyInsertable,CopyAssignable, and) MoveInsertable
> > but not MoveAssignable. An implementation may choose to shuffle the
> > elements along by destruct-and-move rather than copy assign.
> > Invalidating everything after the insertion point gives greater
> > implementation freedom.
>
> Sorry, could you please elaborate on this a bit more? A type can't be
> CopyAssignable without also being MoveAssignable:
>
> http://eel.is/c++draft/utility.arg.requirements#tab:cpp17.copyassignable
>

Ah sorry, my mistake.

Still, there's probably some combination of noexcept specifications that
makes the shuffle by destruct-and-move preferable.

Received on 2021-04-28 04:01:41