Error compiling karma::generate from Boost.Spirit

Juan Dent <[email protected]> Fri, 9 Oct 2020 18:59:13 +0000
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <BYAPR14MB3077194117FA58CD71A3A0EA9B080@BYAPR14MB3077.namprd14.prod.outlook.com>
--===============7332957118291760571==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_BYAPR14MB3077194117FA58CD71A3A0EA9B080BYAPR14MB3077namp_"

--_000_BYAPR14MB3077194117FA58CD71A3A0EA9B080BYAPR14MB3077namp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

This code:

            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"

does not compile (the generate line)..
With Visual C++ 2019 I get:

1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generate.h=
pp(82,9): error C2338: error_invalid_expression
1>C:\Users\Juan Dent\Source\Repos\DesignPatternsInModernCpp\Introduction\Bo=
ost.Spirit.TestHarness.cpp(148): message : see reference to function templa=
te instantiation 'bool boost::spirit::karma::generate<std::back_insert_iter=
ator<boost::spirit::utf8_string>,boost::spirit::int_type,int>(OutputIterato=
r &,const Expr &,const Attr &)' being compiled
1>        with
1>        [
1>            OutputIterator=3Dstd::back_insert_iterator<boost::spirit::utf=
8_string>,
1>            Expr=3Dboost::spirit::int_type,
1>            Attr=3Dint
1>        ]
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generator.=
hpp(155,31): error C2039: 'properties': is not a member of 'boost::spirit::=
tag::int_'
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\support\common_t=
erminals.hpp(91): message : see declaration of 'boost::spirit::tag::int_'
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generate.h=
pp(90): message : see reference to class template instantiation 'boost::spi=
rit::traits::properties_of<boost::spirit::tag::int_>' being compiled
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generator.=
hpp(155,5): error C2504: 'properties': base class undefined
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generate.h=
pp(90,35): error C2039: 'value': is not a member of 'boost::spirit::traits:=
:properties_of<boost::spirit::tag::int_>'
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generate.h=
pp(84): message : see declaration of 'boost::spirit::traits::properties_of<=
boost::spirit::tag::int_>'
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generate.h=
pp(90,1): error C2065: 'value': undeclared identifier
1>C:\vcpkg\installed\x64-windows\include\boost\spirit\home\karma\generate.h=
pp(90,1): error C2975: 'N': invalid template argument for 'boost::mpl::int_=
', expected compile-time constant expression

Am I missing an #include?

I notice boost is very particular about which includes it requires =85


Regards,
Juan Dent

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


--_000_BYAPR14MB3077194117FA58CD71A3A0EA9B080BYAPR14MB3077namp_
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">This code:</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; int value =3D 145;</p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; std::string str;</p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; std::back_insert_iterator&lt;std::string&gt; out(str);</p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; karma::generate(out, boost::spirit::qi::int_, value);&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; // str =3D=3D &quot;123&quot;</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">does not compile (the generate line)..</p>
<p class=3D"MsoNormal">With Visual C++ 2019 I get:</p>
<div style=3D"mso-element:para-border-div;border:none;border-bottom:solid w=
indowtext 1.0pt;padding:0in 0in 1.0pt 0in">
<p class=3D"MsoNormal" style=3D"border:none;padding:0in"><o:p>&nbsp;</o:p><=
/p>
</div>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generate.hpp(82,9): error C2338: error_invalid_expression</=
p>
<p class=3D"MsoNormal">1&gt;C:\Users\Juan Dent\Source\Repos\DesignPatternsI=
nModernCpp\Introduction\Boost.Spirit.TestHarness.cpp(148): message : see re=
ference to function template instantiation 'bool boost::spirit::karma::gene=
rate&lt;std::back_insert_iterator&lt;boost::spirit::utf8_string&gt;,boost::=
spirit::int_type,int&gt;(OutputIterator
 &amp;,const Expr &amp;,const Attr &amp;)' being compiled</p>
<p class=3D"MsoNormal">1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with=
</p>
<p class=3D"MsoNormal">1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [</p=
>
<p class=3D"MsoNormal">1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; OutputIterator=3Dstd::back_insert_iterator&lt;boost::sp=
irit::utf8_string&gt;,</p>
<p class=3D"MsoNormal">1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; Expr=3Dboost::spirit::int_type,</p>
<p class=3D"MsoNormal">1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; Attr=3Dint</p>
<p class=3D"MsoNormal">1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]</p=
>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generator.hpp(155,31): error C2039: 'properties': is not a =
member of 'boost::spirit::tag::int_'</p>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\support\common_terminals.hpp(91): message : see declaration of 'b=
oost::spirit::tag::int_'</p>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generate.hpp(90): message : see reference to class template=
 instantiation 'boost::spirit::traits::properties_of&lt;boost::spirit::tag:=
:int_&gt;' being compiled</p>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generator.hpp(155,5): error C2504: 'properties': base class=
 undefined</p>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generate.hpp(90,35): error C2039: 'value': is not a member =
of 'boost::spirit::traits::properties_of&lt;boost::spirit::tag::int_&gt;'</=
p>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generate.hpp(84): message : see declaration of 'boost::spir=
it::traits::properties_of&lt;boost::spirit::tag::int_&gt;'</p>
<p class=3D"MsoNormal">1&gt;C:\vcpkg\installed\x64-windows\include\boost\sp=
irit\home\karma\generate.hpp(90,1): error C2065: 'value': undeclared identi=
fier</p>
<div style=3D"mso-element:para-border-div;border:none;border-bottom:solid w=
indowtext 1.0pt;padding:0in 0in 1.0pt 0in">
<p class=3D"MsoNormal" style=3D"border:none;padding:0in">1&gt;C:\vcpkg\inst=
alled\x64-windows\include\boost\spirit\home\karma\generate.hpp(90,1): error=
 C2975: 'N': invalid template argument for 'boost::mpl::int_', expected com=
pile-time constant expression</p>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Am I missing an #include?</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I notice boost is very particular about which includ=
es it requires =85</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Regards,</p>
<p class=3D"MsoNormal">Juan Dent</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_BYAPR14MB3077194117FA58CD71A3A0EA9B080BYAPR14MB3077namp_--


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


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

--===============7332957118291760571==--