Boost C++ Libraries: Ticket #4730: Limited number of tagged arguments in the accumulator_set constructor ? https://svn.boost.org/trac10/ticket/4730 <p> It seems that we can't use more than 4 tagged arguments in the accumulator_set constructor. Here is an example code to demonstrate my remark : </p> <div class="wiki-code"><div class="code"><pre> <span class="k">using</span> <span class="k">namespace</span> <span class="n">std</span><span class="p">;</span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">accumulators</span><span class="p">;</span> <span class="k">typedef</span> <span class="n">accumulator_set</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="n">features</span><span class="o">&lt;</span><span class="n">tag</span><span class="o">::</span><span class="n">weighted_mean</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_p_square_cumulative_distribution</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_extended_p_square</span><span class="o">&gt;</span><span class="p">,</span> <span class="kt">double</span><span class="o">&gt;</span> <span class="n">AccType1</span><span class="p">;</span> <span class="k">typedef</span> <span class="n">accumulator_set</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="n">features</span><span class="o">&lt;</span><span class="n">tag</span><span class="o">::</span><span class="n">weighted_mean</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_p_square_cumulative_distribution</span><span class="o">&gt;</span><span class="p">,</span> <span class="kt">double</span><span class="o">&gt;</span> <span class="n">AccType2</span><span class="p">;</span> <span class="k">typedef</span> <span class="n">accumulator_set</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="n">features</span><span class="o">&lt;</span><span class="n">tag</span><span class="o">::</span><span class="n">weighted_mean</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_extended_p_square</span><span class="o">&gt;</span><span class="p">,</span> <span class="kt">double</span><span class="o">&gt;</span> <span class="n">AccType3</span><span class="p">;</span> <span class="kt">double</span> <span class="n">probs</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="mf">0.01</span><span class="p">,</span><span class="mf">0.05</span><span class="p">,</span> <span class="mf">0.25</span><span class="p">,</span> <span class="mf">0.33</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.67</span><span class="p">,</span> <span class="mf">0.75</span><span class="p">,</span> <span class="mf">0.95</span><span class="p">,</span> <span class="mf">0.99</span><span class="p">};</span> <span class="n">vector</span><span class="o">&lt;</span><span class="kt">double</span><span class="o">&gt;</span> <span class="n">q_probs</span><span class="p">(</span><span class="n">probs</span><span class="p">,</span> <span class="n">probs</span> <span class="o">+</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">probs</span><span class="p">)</span> <span class="o">/</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">double</span><span class="p">));</span> <span class="n">AccType1</span> <span class="nf">acc1</span><span class="p">(</span><span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">cache_size</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">num_bins</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_extended_p_square</span><span class="o">::</span><span class="n">probabilities</span> <span class="o">=</span> <span class="n">q_probs</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_p_square_cumulative_distribution</span><span class="o">::</span><span class="n">num_cells</span> <span class="o">=</span> <span class="mi">10</span><span class="p">);</span> <span class="c1">// compiles (4 tagged arguments)</span> <span class="n">AccType1</span> <span class="nf">acc2</span><span class="p">(</span><span class="n">sample</span> <span class="o">=</span> <span class="mi">42</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">cache_size</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">num_bins</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_extended_p_square</span><span class="o">::</span><span class="n">probabilities</span> <span class="o">=</span> <span class="n">q_probs</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_p_square_cumulative_distribution</span><span class="o">::</span><span class="n">num_cells</span> <span class="o">=</span> <span class="mi">10</span><span class="p">);</span> <span class="c1">// Error : does not compile (5 tagged arguments)</span> <span class="n">AccType2</span> <span class="nf">acc3</span><span class="p">(</span><span class="n">sample</span> <span class="o">=</span> <span class="mi">42</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">cache_size</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">num_bins</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_p_square_cumulative_distribution</span><span class="o">::</span><span class="n">num_cells</span> <span class="o">=</span> <span class="mi">10</span><span class="p">);</span> <span class="c1">// compiles (4 tagged arguments)</span> <span class="n">AccType3</span> <span class="nf">acc4</span><span class="p">(</span><span class="n">sample</span> <span class="o">=</span> <span class="mi">42</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">cache_size</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_density</span><span class="o">::</span><span class="n">num_bins</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">tag</span><span class="o">::</span><span class="n">weighted_extended_p_square</span><span class="o">::</span><span class="n">probabilities</span> <span class="o">=</span> <span class="n">q_probs</span><span class="p">);</span> <span class="c1">// compiles (4 tagged arguments)</span> </pre></div></div><p> Moreover, I tried </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#define BOOST_PARAMETER_MAX_ARITY 10</span> </pre></div></div><p> but it does not solve the problem. </p> <p> The error message from GCC 4.4.3 compiler is : </p> <pre class="wiki">In file included from /usr/include/boost/accumulators/accumulators.hpp:12, from &lt;my_path&gt;/sandbox.hpp:13, from ../BiipsTest.cpp:11: /usr/include/boost/accumulators/framework/accumulator_set.hpp: In constructor ‘boost::accumulators::accumulator_set&lt;Sample, Features, Weight&gt;::accumulator_set(const A0&amp;, const A1&amp;, const A2&amp;, const A3&amp;, const A4&amp;) [with A0 = boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::sample, const int&gt;, A1 = boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::density_cache_size_&lt;0&gt;, const int&gt;, A2 = boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::density_num_bins_&lt;0&gt;, const int&gt;, A3 = boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::extended_p_square_probabilities_&lt;0&gt;, std::vector&lt;double, std::allocator&lt;double&gt; &gt; &gt;, A4 = boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::p_square_cumulative_distribution_num_cells_&lt;0&gt;, const int&gt;, Sample = int, Features = boost::accumulators::features&lt;boost::accumulators::tag::weighted_mean, boost::accumulators::tag::weighted_density, boost::accumulators::tag::weighted_p_square_cumulative_distribution, boost::accumulators::tag::weighted_extended_p_square, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na&gt;, Weight = double]’: &lt;my_path&gt;/sandbox.hpp:90: instantiated from here /usr/include/boost/accumulators/framework/accumulator_set.hpp:200: error: no match for call to ‘(boost::accumulators::detail::accumulator_params) (boost::accumulators::accumulator_set&lt;int, boost::accumulators::features&lt;boost::accumulators::tag::weighted_mean, boost::accumulators::tag::weighted_density, boost::accumulators::tag::weighted_p_square_cumulative_distribution, boost::accumulators::tag::weighted_extended_p_square, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na&gt;, double&gt;&amp;, const boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::sample, const int&gt;&amp;, const boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::density_cache_size_&lt;0&gt;, const int&gt;&amp;, const boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::density_num_bins_&lt;0&gt;, const int&gt;&amp;, const boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::extended_p_square_probabilities_&lt;0&gt;, std::vector&lt;double, std::allocator&lt;double&gt; &gt; &gt;&amp;, const boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::p_square_cumulative_distribution_num_cells_&lt;0&gt;, const int&gt;&amp;)’ /usr/include/boost/parameter/parameters.hpp:841: note: candidates are: boost::parameter::aux::empty_arg_list boost::parameter::parameters&lt;PS0, PS1, PS2, PS3, PS4&gt;::operator()() const [with PS0 = boost::parameter::required&lt;boost::accumulators::tag::accumulator, boost::parameter::aux::use_default&gt;, PS1 = boost::parameter::optional&lt;boost::accumulators::tag::sample, boost::parameter::aux::use_default&gt;, PS2 = boost::parameter::void_, PS3 = boost::parameter::void_, PS4 = boost::parameter::void_] </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4730 Trac 1.4.3 Steven Watanabe Wed, 06 Apr 2011 23:21:35 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4730#comment:1 https://svn.boost.org/trac10/ticket/4730#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> Your code compiles for me with MSVC 2010 and the current trunk (revision 71033) after I add </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#define BOOST_PARAMETER_MAX_ARITY 10</span> </pre></div></div><p> I don't think anything has changed in Boost that would affect this. Please note that BOOST_PARAMETER_MAX_ARITY needs to be #defined before any Boost.Parameter headers are #included. </p> Ticket