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/
91
Upvotes
r/cpp • u/stanimirov • Jul 04 '18
View all comments
12
u/mcmcc #pragma once Jul 04 '18
Yeah but it must use type erasure so (unless I'm forgetting something) the lambda capture itself must be dynamically allocated which means the move could just be a
unique_ptrmove.In reality, they're probably leveraging some kind of small buffer optimization, forcing moves to be nontrivial... so then it's just a QOI issue.