r/cpp • u/stanimirov • Jul 04 '18
Be Mindful with Compiler-Generated Move Constructors
https://ibob.github.io/blog/2018/07/03/compiler-generated-move/
89
Upvotes
r/cpp • u/stanimirov • Jul 04 '18
View all comments
Show parent comment
11
u/matthieum Jul 04 '18
Exceptions in move constructors make C++ harder to use.
Not from its main proposal, since it still leaves throwing move constructors.
It did raise the question of whether
newthrowing should be deprecated, and if that came to pass then suddenly a whole host of functions could be madenoexcept.For example, most copy-constructors/copy-assignment-operators only throw in case of allocation failures (the data of the source is already checked, after all).
Sutter did a pass and estimated that a large part of the
stdlibrary would instantly becomenoexcept, with significant code-gen and algorithmic advantages.