https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68350

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #9)
> - If the output type is trivially default constructible and is assignable
> from
>   the input type, we can use std::copy (but it's unclear whether that gives
> any
>   benefit if we can't turn it into memcpy/memmove).

It's also not clear that it would be allowed.

struct A { };
struct B {
  B() = default;
  B(A) { do_stuff(); }
  B& operator=(A) { do_other_stuff(); }
};

void (A* f, A* l, B* out) {
  std::uninitialized_copy(f, l, out);
}

It's observable whether we construct B from A, or default construct B and then
assign to it from A.

My patch just removes all uses of std::copy/fill/fill_n in the
std::uninitialized_copy/fill/fill_n algos.

Reply via email to