Recommit r370502: Make vector unconditionally move elements when exceptions are disabled.
The patch was reverted due to some confusion about non-movable types. ie
that explicitly delete their move constructors. However, such types do
the requirement for MoveConstructible, which is required by
std::vector<T> is free choose between using copy or move operations
needs to resize. The standard only candidates that the correct exception
guarantees are provided. When exceptions are disabled these guarantees
trivially satisfied. Meaning vector is free to optimize it's
moving instead of copying.
This patch makes std::vector unconditionally move elements when
disabled. This optimization is conforming according to the current
There are concerns that moving in -fno-noexceptionsmode will be a
users. For example, a user may be surprised to find their code is slower
exceptions enabled than it is disabled. I'm sympathetic to this
I don't think it should block this optimization.
Reviewers: mclow.lists, ldionne, rsmith
Reviewed By: ldionne
Subscribers: zoecarver, christof, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D62228