Closed GPMueller closed 5 years ago
This is not entirely true. The compiler will still try to create the object in place where the function was called https://stackoverflow.com/q/12953127/2305545. Here you can read if or if not a move constructor is implocitly created https://stackoverflow.com/q/26227431/2305545
This blog post gives a nice overview of when which constructors are generated or not: https://foonathan.net/blog/2019/02/26/special-member-functions.html
As the Field
and Expression
classes only store references, until the layer where there is actual data inside the container, there is no need for a move constructor at all, since copying is cheap.
If a function returns a field and there is no default move, the copy constructor will be used, leading to potentially significant inefficiencies.