accumulators icon indicating copy to clipboard operation
accumulators copied to clipboard

Compiling error when using density within a features set.

Open andremueller opened this issue 8 years ago • 1 comments

The following code snipped generates compiler errors:

#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics.hpp>
#include <boost/accumulators/statistics/density.hpp>

using namespace boost::accumulators;
using namespace boost;

typedef accumulator_set<double,features<tag::density>> histogram_type;

int main(int argc, char*argv[])
{
    histogram_type hist;
    hist(1.0);
    hist(2.0);
    return 0;
}

It compiles without problems when removing the features tag such that the line reads

typedef accumulator_set<double, tag::density> histogram_type;

The examples from the documentation uses the features tag together with density.

Error Output

In file included from /usr/local/include/boost/accumulators/statistics.hpp:14,
                 from hist.cpp:2:
/usr/local/include/boost/accumulators/statistics/density.hpp: In constructor ‘boost::accumulators::impl::density_impl<Sample>::density_impl(const Args&) [with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>, Sample = double]’:
/usr/local/include/boost/accumulators/framework/depends_on.hpp:319:   instantiated from ‘boost::accumulators::detail::accumulator_wrapper<Accumulator, Feature>::accumulator_wrapper(const Args&) [with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>, Accumulator = boost::accumulators::impl::density_impl<double>, Feature = boost::accumulators::tag::density]’
/usr/local/include/boost/accumulators/framework/depends_on.hpp:252:   instantiated from ‘static boost::fusion::cons<typename boost::fusion::result_of::value_of<Iterator>::type, typename boost::accumulators::detail::build_acc_list<typename boost::fusion::result_of::next<Iterator>::type, Last, boost::fusion::result_of::equal_to::value>::type> boost::accumulators::detail::build_acc_list<First, Last, false>::call(const Args&, const First&, const Last&) [with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>, First = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 3l> >, Last = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 4l> >]’
/usr/local/include/boost/accumulators/framework/depends_on.hpp:252:   instantiated from ‘static boost::fusion::cons<typename boost::fusion::result_of::value_of<Iterator>::type, typename boost::accumulators::detail::build_acc_list<typename boost::fusion::result_of::next<Iterator>::type, Last, boost::fusion::result_of::equal_to::value>::type> boost::accumulators::detail::build_acc_list<First, Last, false>::call(const Args&, const First&, const Last&) [with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>, First = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 2l> >, Last = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 4l> >]’
/usr/local/include/boost/accumulators/framework/depends_on.hpp:252:   instantiated from ‘static boost::fusion::cons<typename boost::fusion::result_of::value_of<Iterator>::type, typename boost::accumulators::detail::build_acc_list<typename boost::fusion::result_of::next<Iterator>::type, Last, boost::fusion::result_of::equal_to::value>::type> boost::accumulators::detail::build_acc_list<First, Last, false>::call(const Args&, const First&, const Last&) [with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>, First = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 1l> >, Last = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 4l> >]’
/usr/local/include/boost/accumulators/framework/depends_on.hpp:252:   instantiated from ‘static boost::fusion::cons<typename boost::fusion::result_of::value_of<Iterator>::type, typename boost::accumulators::detail::build_acc_list<typename boost::fusion::result_of::next<Iterator>::type, Last, boost::fusion::result_of::equal_to::value>::type> boost::accumulators::detail::build_acc_list<First, Last, false>::call(const Args&, const First&, const Last&) [with Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>, First = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 0l> >, Last = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, 4l> >]’
/usr/local/include/boost/accumulators/framework/depends_on.hpp:271:   instantiated from ‘typename boost::accumulators::detail::meta::make_acc_list<Sequence>::type boost::accumulators::detail::make_acc_list(const Sequence&, const Args&) [with Sequence = boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::density_impl<double>, boost::accumulators::tag::density>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::min_impl<double>, boost::accumulators::tag::min>, boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::count_impl, boost::accumulators::tag::count>, boost::mpl::vector0<mpl_::na>, 0>, 0>, 0>, 0>, Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, boost::parameter::aux::empty_arg_list>]’
/usr/local/include/boost/accumulators/framework/accumulator_set.hpp:145:   instantiated from ‘boost::accumulators::accumulator_set<Sample, Features, Weight>::accumulator_set() [with Sample = double, Features = boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, Weight = void]’
hist.cpp:12:   instantiated from here
/usr/local/include/boost/accumulators/statistics/density.hpp:84: error: no match for ‘operator[]’ in ‘args[boost::accumulators::<unnamed>::density_cache_size]’
/usr/local/include/boost/parameter/aux_/arg_list.hpp:327: note: candidates are: typename boost::mpl::eval_if<typename boost::parameter::aux::is_maybe<typename TaggedArg::value_type>::type, boost::parameter::aux::get_reference<typename TaggedArg::value_type>, boost::parameter::aux::get_reference<TaggedArg> >::type boost::parameter::aux::arg_list<TaggedArg, Next>::operator[](const boost::parameter::keyword<typename TaggedArg::key_type>&) const [with TaggedArg = boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, Next = boost::parameter::aux::empty_arg_list]
/usr/local/include/boost/accumulators/statistics/density.hpp:84: error: no match for ‘operator[]’ in ‘args[boost::accumulators::<unnamed>::density_num_bins]’
/usr/local/include/boost/parameter/aux_/arg_list.hpp:327: note: candidates are: typename boost::mpl::eval_if<typename boost::parameter::aux::is_maybe<typename TaggedArg::value_type>::type, boost::parameter::aux::get_reference<typename TaggedArg::value_type>, boost::parameter::aux::get_reference<TaggedArg> >::type boost::parameter::aux::arg_list<TaggedArg, Next>::operator[](const boost::parameter::keyword<typename TaggedArg::key_type>&) const [with TaggedArg = boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::density, 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, mpl_::na, mpl_::na, mpl_::na>, void> >, Next = boost::parameter::aux::empty_arg_list]

Version

Boost v1.61, gnu g++ v4.4.5

andremueller avatar Nov 16 '16 08:11 andremueller

It compiles when adding the tags for num_bins and cache_size - then the features can be used. A bit strange. I am really unsure if this is a problem. The compiler errors are really counterintuitive.

histogram_type hist(tag::density::num_bins = 20, tag::density::cache_size = 10);

andremueller avatar Nov 16 '16 09:11 andremueller