|
|
|
|
|
by dthul
1416 days ago
|
|
To chime in with my personal experience, I did actually lose almost two days on hunting down an unintended copy constructor call.
The method expected a "const B&" but was called with a "const A&". It also happened to be called a lot. The actual type names were longer and very similar, and looking at the code it was hard to see they were different. Type B had a copy/conversion constructor from type A so every time the method was called all of the data contained in A would be cloned.
I was very relieved when I finally found the issue but also wished that C++ wouldn't call (possibly expensive) constructors so hiddenly, even going so far as to not only do that for value types but even for reference types. |
|