<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Boost Parameter Minialbeispiel kompiliert nicht]]></title><description><![CDATA[<p>Ich spiele Gerade etwas mit Boost Parameter rum, bekomme aber nichts zum kompilieren. Dabei habe ich festgestellt, dass nicht mal das minimalbeispiel aus der Boost Doku kompiliert:</p>
<pre><code>#include &lt;iostream&gt;
#include&lt;boost/parameter/keyword.hpp&gt;
#include&lt;boost/parameter/name.hpp&gt;
#include&lt;boost/parameter/parameters.hpp&gt;

BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)

struct myclass_impl
{
    template &lt;class ArgumentPack&gt;
    myclass_impl(ArgumentPack const&amp; args)
    {
        std::cout &lt;&lt; &quot;name = &quot; &lt;&lt; args[_name]
                  &lt;&lt; &quot;; index = &quot; &lt;&lt; args[_index | 42]
                  &lt;&lt; std::endl;
    }
};

struct myclass : myclass_impl
{
    BOOST_PARAMETER_CONSTRUCTOR(
        myclass, (myclass_impl), tag
      , (required (name,*)) (optional (index,*))) // no semicolon
};
int main(int argc, char **argv) {
}
</code></pre>
<p>liefert:</p>
<pre><code>/home/andreas/projects/Testboost/main.cpp:23:18: error: expected identifier before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:23:34: error: ‘tag’ is not a type
/home/andreas/projects/Testboost/main.cpp:24:9: error: expected identifier before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:24:19: error: expected ‘)’ before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:24:19: error: expected ‘)’ before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:24:20: error: ‘name’ has not been declared
/home/andreas/projects/Testboost/main.cpp:24:25: error: expected identifier before ‘*’ token
/home/andreas/projects/Testboost/main.cpp:24:26: error: ISO C++ forbids declaration of ‘BOOST_PARAMETER_CONSTRUCTOR’ with no type [-fpermissive]
/home/andreas/projects/Testboost/main.cpp:24:26: error: ‘BOOST_PARAMETER_CONSTRUCTOR’ declared as function returning a function
/home/andreas/projects/Testboost/main.cpp:24:26: error: expected ‘;’ at end of member declaration
/home/andreas/projects/Testboost/main.cpp:24:27: error: expected unqualified-id before ‘)’ token
</code></pre>
<p>Wie kann das sein?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/323257/boost-parameter-minialbeispiel-kompiliert-nicht</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 06:52:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/323257.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 23 Jan 2014 12:40:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Boost Parameter Minialbeispiel kompiliert nicht on Thu, 23 Jan 2014 12:40:06 GMT]]></title><description><![CDATA[<p>Ich spiele Gerade etwas mit Boost Parameter rum, bekomme aber nichts zum kompilieren. Dabei habe ich festgestellt, dass nicht mal das minimalbeispiel aus der Boost Doku kompiliert:</p>
<pre><code>#include &lt;iostream&gt;
#include&lt;boost/parameter/keyword.hpp&gt;
#include&lt;boost/parameter/name.hpp&gt;
#include&lt;boost/parameter/parameters.hpp&gt;

BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)

struct myclass_impl
{
    template &lt;class ArgumentPack&gt;
    myclass_impl(ArgumentPack const&amp; args)
    {
        std::cout &lt;&lt; &quot;name = &quot; &lt;&lt; args[_name]
                  &lt;&lt; &quot;; index = &quot; &lt;&lt; args[_index | 42]
                  &lt;&lt; std::endl;
    }
};

struct myclass : myclass_impl
{
    BOOST_PARAMETER_CONSTRUCTOR(
        myclass, (myclass_impl), tag
      , (required (name,*)) (optional (index,*))) // no semicolon
};
int main(int argc, char **argv) {
}
</code></pre>
<p>liefert:</p>
<pre><code>/home/andreas/projects/Testboost/main.cpp:23:18: error: expected identifier before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:23:34: error: ‘tag’ is not a type
/home/andreas/projects/Testboost/main.cpp:24:9: error: expected identifier before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:24:19: error: expected ‘)’ before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:24:19: error: expected ‘)’ before ‘(’ token
/home/andreas/projects/Testboost/main.cpp:24:20: error: ‘name’ has not been declared
/home/andreas/projects/Testboost/main.cpp:24:25: error: expected identifier before ‘*’ token
/home/andreas/projects/Testboost/main.cpp:24:26: error: ISO C++ forbids declaration of ‘BOOST_PARAMETER_CONSTRUCTOR’ with no type [-fpermissive]
/home/andreas/projects/Testboost/main.cpp:24:26: error: ‘BOOST_PARAMETER_CONSTRUCTOR’ declared as function returning a function
/home/andreas/projects/Testboost/main.cpp:24:26: error: expected ‘;’ at end of member declaration
/home/andreas/projects/Testboost/main.cpp:24:27: error: expected unqualified-id before ‘)’ token
</code></pre>
<p>Wie kann das sein?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2379158</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2379158</guid><dc:creator><![CDATA[TNA]]></dc:creator><pubDate>Thu, 23 Jan 2014 12:40:06 GMT</pubDate></item><item><title><![CDATA[Reply to Boost Parameter Minialbeispiel kompiliert nicht on Thu, 23 Jan 2014 13:20:37 GMT]]></title><description><![CDATA[<p>Hat sich erledigt, war ein vergessenes include. Wobei das nirgendwo erläutert war und auch die Fehlermeldung nicht geholfen hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2379165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2379165</guid><dc:creator><![CDATA[TNA]]></dc:creator><pubDate>Thu, 23 Jan 2014 13:20:37 GMT</pubDate></item></channel></rss>