(no subject)
Juan Dent <[email protected]> Fri, 9 Oct 2020 12:14:14 +0000
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <BYAPR14MB3077C75C6A710F9C2B996BB69B080@BYAPR14MB3077.namprd14.prod.outlook.com> |
--===============5698462995213389660==
Content-Language: en-US
Content-Type: multipart/alternative;
boundary="_000_BYAPR14MB3077C75C6A710F9C2B996BB69B080BYAPR14MB3077namp_"
--_000_BYAPR14MB3077C75C6A710F9C2B996BB69B080BYAPR14MB3077namp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hi,
I need help. I have from Boost.Spirit site I copied the following code:
std::string input("1.0 2.0");
std::string::iterator strbeg =3D input.begin();
std::pair<double, double> p;
qi::phrase_parse(strbeg, input.end(),
qi::double_ >> qi::double_, // parser grammar
space, // delimiter grammar
p); // attribute to fill while pa=
rsing
I get this error:
C:\vcpkg\installed\x64-windows\include\boost\spirit\home\qi\deta=
il\assign_to.hpp(153,1): error C2440: 'static_cast': cannot convert from 'c=
onst T_' to 'Attribute'
1> with
1> [
1> T_=3Ddouble
1> ]
1> and
1> [
1> Attribute=3Dstd::pair<double,double>
1> ]
So the sequence qi::double_ >> qi::double_ is producing a single attribute =
of type double instead of a sequence of doubles storable in a std::pair??
Something is seriously wrong here. Of course you cannot static_cast<Attribu=
te> (double)
If I change p to double it runs fine=85of course it only gets ONE double
Please help,
Juan Dent
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=3D550986> for Window=
s 10
--_000_BYAPR14MB3077C75C6A710F9C2B996BB69B080BYAPR14MB3077namp_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">Hi, </p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">I need help. I have from Boost.Spirit site I copied =
the following code:</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">std::string input("1.0 2.0");</p>
<p class=3D"MsoNormal"> std::stri=
ng::iterator strbeg =3D input.begin();</p>
<p class=3D"MsoNormal"> std::pair=
<double, double> p;</p>
<p class=3D"MsoNormal"> qi::phras=
e_parse(strbeg, input.end(),</p>
<p class=3D"MsoNormal"> &nbs=
p; qi::double_ >> qi::double_, &nb=
sp; // parser grammar
</p>
<p class=3D"MsoNormal"> &nbs=
p; space, &=
nbsp; &nbs=
p; // delimiter grammar</p>
<p class=3D"MsoNormal"> &nbs=
p; p); &nb=
sp; =
// attribute to fill while=
parsing</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">I get this error:</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"> &nbs=
p; C:\vcpkg\installed\x64-windows\include\boost\spirit\home\qi\detail=
\assign_to.hpp(153,1): error C2440: 'static_cast': cannot convert from 'con=
st T_' to 'Attribute'</p>
<p class=3D"MsoNormal">1> with=
</p>
<p class=3D"MsoNormal">1> [</p=
>
<p class=3D"MsoNormal">1>  =
; T_=3Ddouble</p>
<p class=3D"MsoNormal">1> ]</p=
>
<p class=3D"MsoNormal">1> and<=
/p>
<p class=3D"MsoNormal">1> [</p=
>
<p class=3D"MsoNormal">1>  =
; Attribute=3Dstd::pair<double,double></p>
<p class=3D"MsoNormal">1> ]</p=
>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">So the sequence qi::double_ >> qi::double_ is =
producing a single attribute of type double instead of a sequence of double=
s storable in a std::pair??</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">Something is seriously wrong here. Of course you can=
not static_cast<Attribute> (double)</p>
<p class=3D"MsoNormal">If I change p to double it runs fine=85of course it =
only gets ONE double</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">Please help,</p>
<p class=3D"MsoNormal">Juan Dent</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal">Sent from <a href=3D"https://go.microsoft.com/fwlink=
/?LinkId=3D550986">
Mail</a> for Windows 10</p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>
--_000_BYAPR14MB3077C75C6A710F9C2B996BB69B080BYAPR14MB3077namp_--
--===============5698462995213389660==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============5698462995213389660==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general
--===============5698462995213389660==--