5 Feb 22:45
Rule and C++11 auto type on VS2010
Claude <clros <at> tiscali.it>
2012-02-05 21:45:54 GMT
2012-02-05 21:45:54 GMT
Hi!
I used this code for parsing a date in format yyyy-mm-dd:
uint32_t day=0,month=0;
uint32_t year;
std::string myStr("1974-5-10");
std::string::const_iterator begin = myStr.begin(), end = myStr.end();
auto rDate = qi::uint_>>'-'>>qi::uint_>>'-'>>qi::uint_;
if (qi::phrase_parse(begin, end, rDate, qi::space,year,month,day) )
{
cout<<"Parse Ok!"<<endl;
cout<<"Year: "<<year<<" Month:
"<<month<<" Day: "<<day<<endl;
}
This code work well, but if I use it in most complex program, it don’t work
<smiley image="smiley_what.gif"/>
I discovered that the problem is the rDate variable. If it is a C++11 /auto/
variable, in my complex program, on the Visual C++2010, phrase_parse() don’t
parse correctly. (this problem are not present on GCC 4.6.1 on Ubuntu!)
For this reason I changed the rValue type:
qi::rule<std::string::const_iterator> rDate =
qi::uint_>>'-'>>qi::uint_>>'-'>>qi::uint_;
Now phrase_parse() work, but I don’t obtain the correct value of year,month
an day.
I think the problem is the type of rdate.
How can I fix?
Why in Visual C++ auto type don't work correctly?
--
View this message in context: http://boost.2283326.n4.nabble.com/Rule-and-C-11-auto-type-on-VS2010-tp4359859p4359859.html
Sent from the spirit-general mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
RSS Feed