boost::spirit::karma::generate no working as per documentation

Juan Dent <[email protected]> Thu, 8 Oct 2020 23:39:20 +0000
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <BYAPR14MB30775AEB1E25846883554C439B0B0@BYAPR14MB3077.namprd14.prod.outlook.com>
--===============8607813197821004862==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_BYAPR14MB30775AEB1E25846883554C439B0B0BYAPR14MB3077namp_"

--_000_BYAPR14MB30775AEB1E25846883554C439B0B0BYAPR14MB3077namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

I am taking a code sample from the documentation of Boost.Spirit (see https=
://www.boost.org/doc/libs/1_74_0/libs/spirit/doc/html/spirit/abstracts/attr=
ibutes/primitive_attributes.html), the code is as simple as is possible, li=
ke so:



1
2
3
4
5
6

namespace karma =3D boost::spirit::karma;



int value =3D 145;

std::string str;

std::back_insert_iterator<std::string> out(str);

karma::generate(out, boost::spirit::qi::int_, value);          // str =3D=
=3D "123"


I get the error in the generate call: error_invalid_expression with the tem=
plate arguments as such:




OutputIterator=3Dstd::back_insert_iterator<boost::spirit::utf8_string>,

Expr=3Dboost::spirit::int_type,

Attr=3Dint



Other errors occur explaining this main error:




error C2039: 'properties': is not a member of 'boost::spirit::tag::int_'

error C2504: 'properties': base class undefined

error C2039: 'value': is not a member of 'boost::spirit::traits::properties=
_of<boost::spirit::tag::int_>'


Please help!!

Thanks
Juan

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=3D550986> for Window=
s 10


--_000_BYAPR14MB30775AEB1E25846883554C439B0B0BYAPR14MB3077namp_
Content-Type: text/html; charset="us-ascii"
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=3Dus-ascii"=
>
<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;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 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;}
code
	{mso-style-priority:99;
	font-family:"Courier New";}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
samp
	{mso-style-priority:99;
	font-family:"Courier New";}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:"Courier New";}
.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">
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:9.0pt;font-family:&quot;Ver=
dana&quot;,sans-serif;color:black;background:white">Hi,</span><span style=
=3D"font-size:9.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:black"=
><br>
<br>
<span style=3D"background:white">I am taking a code sample from the documen=
tation of Boost.Spirit (see&nbsp;</span></span><a href=3D"https://www.boost=
.org/doc/libs/1_74_0/libs/spirit/doc/html/spirit/abstracts/attributes/primi=
tive_attributes.html),"><span style=3D"font-size:9.0pt;font-family:&quot;Ve=
rdana&quot;,sans-serif;color:#000070;background:white">https://www.boost.or=
g/doc/libs/1_74_0/libs/spirit/doc/html/spirit/abstracts/attributes/primitiv=
e_attributes.html),</span></a><span style=3D"font-size:9.0pt;font-family:&q=
uot;Verdana&quot;,sans-serif;color:black;background:white">&nbsp;the
 code is as simple as is possible, like so:</span><span style=3D"font-size:=
9.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:black"><br>
<br style=3D"font-variant-ligatures: normal;font-variant-caps: normal;orpha=
ns: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decora=
tion-style: initial;text-decoration-color: initial;word-spacing:0px">
<br>
</span><o:p></o:p></p>
<div>
<table class=3D"MsoNormalTable" border=3D"0" cellspacing=3D"3" cellpadding=
=3D"0">
<tbody>
<tr>
<td valign=3D"top" style=3D"padding:.75pt .75pt .75pt .75pt">
<pre style=3D"text-align:right"><code><span style=3D"color:#A0A0A0">1</span=
></code><span style=3D"color:#A0A0A0"><br><code>2</code><br><code>3</code><=
br><code>4</code><br><code>5</code><br><code>6</code><o:p></o:p></span></pr=
e>
</td>
<td valign=3D"top" style=3D"border:solid #C0C0D0 1.0pt;background:#EFEFFF;p=
adding:.75pt .75pt .75pt .75pt">
<pre><var><span style=3D"font-family:&quot;Courier New&quot;;color:#0000B0;=
font-style:normal">namespace</span></var><code><span style=3D"color:black">=
 karma =3D boost::spirit::karma;<o:p></o:p></span></code></pre>
<pre><code><span style=3D"color:black"><o:p>&nbsp;</o:p></span></code></pre=
>
<pre><var><span style=3D"font-family:&quot;Courier New&quot;;color:#0000B0;=
font-style:normal">int</span></var><code><span style=3D"color:black"> value=
 =3D 145;<o:p></o:p></span></code></pre>
<pre><code><span style=3D"color:black">std::string str;<o:p></o:p></span></=
code></pre>
<pre><code><span style=3D"color:black">std::back_insert_iterator&lt;std::st=
ring&gt; out(str);<o:p></o:p></span></code></pre>
<pre><code><span style=3D"color:black">karma::generate(out, boost::spirit::=
qi::int_, value);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </s=
pan></code><cite><span style=3D"font-family:&quot;Courier New&quot;;color:#=
007000;font-style:normal">// str =3D=3D &quot;123&quot; </span></cite><span=
 style=3D"color:black"><o:p></o:p></span></pre>
</td>
<td style=3D"padding:.75pt .75pt .75pt .75pt"></td>
</tr>
</tbody>
</table>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:9.0pt;font-family:&quot;Ver=
dana&quot;,sans-serif;color:black"><br>
<br>
<span style=3D"background:white">I get the error in the generate call: erro=
r_invalid_expression with the template arguments as such:</span><br style=
=3D"font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;tex=
t-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-styl=
e: initial;text-decoration-color: initial;word-spacing:0px">
<br>
</span><o:p></o:p></p>
<div>
<table class=3D"MsoNormalTable" border=3D"0" cellspacing=3D"3" cellpadding=
=3D"0">
<tbody>
<tr>
<td valign=3D"top" style=3D"border:solid silver 1.0pt;background:#E7E7E7;pa=
dding:.75pt .75pt .75pt .75pt">
<pre><samp><span style=3D"color:black"><o:p>&nbsp;</o:p></span></samp></pre=
>
<pre><samp><span style=3D"color:black">OutputIterator=3Dstd::back_insert_it=
erator&lt;boost::spirit::utf8_string&gt;,<o:p></o:p></span></samp></pre>
<pre><samp><span style=3D"color:black">Expr=3Dboost::spirit::int_type,<o:p>=
</o:p></span></samp></pre>
<pre><samp><span style=3D"color:black">Attr=3Dint<o:p></o:p></span></samp><=
/pre>
</td>
</tr>
</tbody>
</table>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:9.0pt;font-family:&quot;Ver=
dana&quot;,sans-serif;color:black"><br>
<br>
<br>
<span style=3D"background:white">Other errors occur explaining this main er=
ror:</span><br style=3D"font-variant-ligatures: normal;font-variant-caps: n=
ormal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;=
text-decoration-style: initial;text-decoration-color: initial;word-spacing:=
0px">
<br>
</span><o:p></o:p></p>
<div>
<table class=3D"MsoNormalTable" border=3D"0" cellspacing=3D"3" cellpadding=
=3D"0">
<tbody>
<tr>
<td valign=3D"top" style=3D"border:solid silver 1.0pt;background:#E7E7E7;pa=
dding:.75pt .75pt .75pt .75pt">
<pre><samp><span style=3D"color:black"><o:p>&nbsp;</o:p></span></samp></pre=
>
<pre><samp><span style=3D"color:black">error C2039: 'properties': is not a =
member of 'boost::spirit::tag::int_'<o:p></o:p></span></samp></pre>
<pre><samp><span style=3D"color:black">error C2504: 'properties': base clas=
s undefined<o:p></o:p></span></samp></pre>
<pre><samp><span style=3D"color:black">error C2039: 'value': is not a membe=
r of 'boost::spirit::traits::properties_of&lt;boost::spirit::tag::int_&gt;'=
<o:p></o:p></span></samp></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Please help!!</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Thanks</p>
<p class=3D"MsoNormal">Juan</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</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>&nbsp;</o:p></p>
</div>
</body>
</html>

--_000_BYAPR14MB30775AEB1E25846883554C439B0B0BYAPR14MB3077namp_--


--===============8607813197821004862==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============8607813197821004862==
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

--===============8607813197821004862==--