[xsd-users] Feature request: Explicit constructors
Benjamin Schindler
bschindler at inf.ethz.ch
Thu Nov 18 04:26:10 EST 2010
Hi
I just stumbled across a problem with explicit conversions. I have a
class with 2 constructors:
MyClass(FrameKind, double)
MyClass(const std::string&, double)
Now, FrameKind is a class generated from xml, and it looks like this:
<xs:simpleType name="FrameKind_t">
<xs:restriction base="xs:string">
<xs:enumeration value="Regular" />
<xs:enumeration value="TrackGlobal" />
<xs:enumeration value="TimeGlobal" />
<xs:enumeration value="WorldGlobal" />
</xs:restriction>
</xs:simpleType>
When calling the constructor with MyClass("someText", 1.0), the compiler
refuses as the string someText can be implicitly converted to a
FrameKind. Would it be possible to make this constructor explicit
preventing the implicit conversion?
Thank You
Benjamin Schindler
More information about the xsd-users
mailing list