[xsd-users] suggestion to optional template

Chang Chen chenchang19760717 at yahoo.com
Fri Nov 25 01:34:41 EST 2005


         Clean  Clean  DocumentEmail      false  false  false                        MicrosoftInternetExplorer4    /* Style Definitions */  table.MsoNormalTable	{mso-style-name:"Table Normal";	mso-tstyle-rowband-size:0;	mso-tstyle-colband-size:0;	mso-style-noshow:yes;	mso-style-parent:"";	mso-padding-alt:0in 5.4pt 0in 5.4pt;	mso-para-margin:0in;	mso-para-margin-bottom:.0001pt;	mso-pagination:widow-orphan;	font-size:10.0pt;	font-family:"Times New Roman";	mso-ansi-language:#0400;	mso-fareast-language:#0400;	mso-bidi-language:#0400;}
Hi,

 

I am reading the code which XSD generates, I find that theXSD use optional template for optional property.

 

I suggest that declare operator == and !=to avoid the user can write code such as:

 

…..

typedef ::xsd::cxx::tree::optional< xml_schema::string> string_container_;

string_container_ s;

string_container_ ss;

&#8230;.

 

//????

// problematic.

// it will be compiled and make no sense, because it call optional::operator bool_convertible,

// the return value is 0 or &optional::reset().

If (s == ss) 

{}

 

If  the userswrite if statement like the above, it may mean they want to compare theinternal auto_prt<X> member, but if it is forbidden,we should declare operator == and != as private and do not implement it; and ifthis operation make sense, we should implement it.

 

Thanks


		
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codesynthesis.com/pipermail/xsd-users/attachments/20051124/efb54ec9/attachment.html


More information about the xsd-users mailing list