The standard explicitly states that the copy constructor is a non-template constructor that references a possibly const-volatile object of the same type. In the above code, you have a transform, but not a copy constructor (i.e., it will be used for everything except for copies where an implicitly declared constructor will be used).
Does Foo a copy constructor?
Yes, an implicitly declared / specific copy constructor.
Is it safe to use Foo with standard library containers?
With the current definition of Foo it is, but in the general case it depends on what the members of Foo have and whether the implicitly defined copy constructor correctly controls it.
David Rodríguez - dribeas
source share