If I turn on gcc's -Wextra option when compiling code that uses an
accumulator with tag::max, I get a screen full of compiler warnings:
[wheeler@cib: /var/tmp/acc] cat acc.cpp
#include <iostream>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/max.hpp>
using namespace boost::accumulators;
int main()
{
accumulator_set<double, stats<tag::max> > acc;
acc(1.2);
acc(2.3);
acc(3.4);
acc(4.5);
std::cout << "Max: " << max(acc) << std::endl;
return 0;
}
[wheeler@cib: /var/tmp/acc] g++ -W -I /opt/ros/include/boost-1_37/ acc.cpp -o acc
/opt/ros/include/boost-1_37/boost/concept_check.hpp: In instantiation of ‘boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&>’:
/opt/ros/include/boost-1_37/boost/concept/detail/has_constraints.hpp:40: instantiated from ‘const bool boost::concept::not_satisfied<boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&> >::value’
/opt/ros/include/boost-1_37/boost/concept/detail/has_constraints.hpp:43: instantiated from ‘boost::concept::not_satisfied<boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&> >’
/opt/ros/include/boost-1_37/boost/mpl/if.hpp:67: instantiated from ‘boost::mpl::if_<boost::concept::not_satisfied<boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&> >, boost::concept::constraint<boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&> >, boost::concept::requirement<boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&> > >’
/opt/ros/include/boost-1_37/boost/concept/detail/general.hpp:19: instantiated from ‘boost::concept::requirement_<void (*)(boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&>)>’
/opt/ros/include/boost-1_37/boost/accumulators/numeric/detail/function1.hpp:67: instantiated from ‘typename boost::detail::function1<F>::result<boost::detail::function1<F> ()(const A0&)>::type boost::detail::function1<F>::operator()(const A0&) const [with A0 = double, F = boost::numeric::functional::as_min<mpl_::arg<-0x00000000000000001>, boost::numeric::functional::tag<mpl_::arg<-0x00000000000000001> > >]’
/opt/ros/include/boost-1_37/boost/accumulators/statistics/max.hpp:36: instantiated from ‘boost::accumulators::impl::max_impl<Sample>::max_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::stats<boost::accumulators::tag::max,
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]’
/opt/ros/include/boost-1_37/boost/accumulators/framework/depends_on.hpp:282: 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::stats<boost::accumulators::tag::max,
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::max_impl<double>, Feature = boost::accumulators::tag::max]’
/opt/ros/include/boost-1_37/boost/accumulators/framework/depends_on.hpp:215: 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<typename boost::fusion::result_of::next<Iterator>::type,Last>::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::stats<boost::accumulators::tag::max,
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::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::vector0<mpl_::na>, 0>, 0l> >, Last = boost::fusion::mpl_iterator<boost::mpl::v_iter<boost::mpl::v_item<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::vector0<mpl_::na>, 0>, 1l> >]’
/opt/ros/include/boost-1_37/boost/accumulators/framework/depends_on.hpp:234: 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::max_impl<double>, boost::accumulators::tag::max>, boost::mpl::vector0<mpl_::na>, 0>, Args = boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::accumulators::tag::accumulator, boost::accumulators::accumulator_set<double, boost::accumulators::stats<boost::accumulators::tag::max,
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>]’
/opt/ros/include/boost-1_37/boost/accumulators/framework/accumulator_set.hpp:145: instantiated from ‘boost::accumulators::accumulator_set<Sample,
Features, Weight>::accumulator_set() [with Sample = double, Features
= boost::accumulators::stats<boost::accumulators::tag::max,
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]’
acc.cpp:9: instantiated from here
/opt/ros/include/boost-1_37/boost/concept_check.hpp:325: warning: non-static reference ‘const double& boost::UnaryFunction<boost::numeric::functional::as_min<const double, void>, double, const double&>::arg’ in class without a constructor