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
2
u/matthieum Jul 04 '18
There is, at least in libstdc++ you should not have an allocation if your lambda only needs 8 bytes of storage.
Thus, you need to choose between:
noexceptmove constructor forstd::function,At a glance, I'd pick (1) over (2) since I cannot think of such trivial objects which cannot be moved, so they don't seem very common, but I guess the committee had motivating examples.