With the advent of move semantics I am wondering if this specific template technique implemented by King in his dlib library are still useful after temporarily created objects are able to pass on ownership with the help of move semantics or am I missing something here?
Asked
Active
Viewed 86 times
2 Answers
1
There is a lot more to the expression template technique than mere avoidance of copying. For example, the compiler can do symbolic linear algebra to transform entire expressions into more efficiently executing code. Many of these transformations have nothing to do with avoiding copies.

Davis King
- 4,731
- 1
- 25
- 26
0
Compiler will automatically create default move constructor only if there is no user-defined move constructors are provided for a class type (struct, class, or union), and all of the following is true:
- there are no user-declared copy constructors;
- there are no user-declared copy assignment operators;
- there are no user-declared move assignment operators;
- there are no user-declared destructors;
- the implicitly-declared move constructor is not defined as deleted due to conditions detailed in the next section,
Thats why Dlib has a lot of explicitly defined move constructors in its containers (array2d, DNN module...)

Evgeniy
- 2,481
- 14
- 24