[size=2]I edited the original post, not to change what I said, but to visually strike-out the wrong info and add a link to this thread.
The Lavavej video at ~35:00 indicates the proper time to use pass-by-value would be when you are creating a copy from the const ref anyway, because then with temporaries the copy can be avoided; as STL puts it in other places: "Never slower, but sometimes faster".
So, general rule of thumb seems to be:
- Default to const ref, unless...
- ...you need to modify the original, then default to regular ref
- ...you need to make a copy, then default to by-value which will sometimes (depending on move constructor) optimize away the copy for temporaries.
- ...you need to modify the original, then default to regular ref
Which was pretty much the same rule of thumb C++ has always had.