According to "Optimizing software in C++" by Agner Fog (2018-08-18), page 50, if any of these conditions is not met then it is usually faster to transfer a pointer or reference to the object.
- the object is so small that it fits into a single register
- the object has no copy constructor and no destructor
- the object has no virtual member
- the object does not use runtime type identification (RTTI)
The reasoning behind the first 2 conditions is fairly obvious. The 3rd condition is due the vptr that is added to the object, which would make it "too large" to pass-by-value efficiently. Is that correct?
Can anybody please explain the 4th condition?