[xsd-users] template<typename C> type_(const C*) constructor creates unexpected empty copies of any pointer

Oliver Schneider xsd-users at oli-obk.de
Mon Sep 15 08:53:51 EDT 2014


Hi Boris,

I ran into another situation of the same kind.
The idref class has constructors that'll happily take strings, char* and
some others as arguments. It's really easy to accidentally use them.

I have not had any issues changing all of the idref constructors to
explicit. After changing it, the compiler will prevent accidental use of
the constructors (like when using auto instead of auto&).

greetings

/oliver

Am 18.08.2014 12:29, schrieb Boris Kolpackov:
> Hi Oliver,
> 
> Oliver Schneider <xsd-users at oli-obk.de> writes:
> 
>> I suggest adding an "explicit" before the templated type_ constructor.
> 
> Good idea, added. Thanks for the report/suggestion!
> 
> Boris
> 



More information about the xsd-users mailing list