Lecture 2 - Slide 20 : 29
Value return
The semantics of value return is that of
initialization
The C++ Prog. Lang. (3. edition)
:
Page 148
The C++ Prog. Lang. (4. edition)
: Value return. Page 308
Value return
A copy is returned, initializing an unnamed variable
The copy constructor is used - not the assignment operator
If a move constructor exists, it may be used (transparently)
Return of local variables
OK by value - efficient via move semantics
References or pointers to local (automatic) variables should not be returned