On my Mac (OSX 10.9.2, running clang++ "Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)”), I can’t get the libs/accumulators/test/valarray.cpp regression test to compile. The error it gives is of course lengthy, but goes something like this:
In file included from valarray.cpp:18:
../../../boost/accumulators/statistics/weighted_mean.hpp:73:13: error: no matching constructor for initialization of 'result_type' (aka 'valarray::result_type>')
: mean(
../../../boost/accumulators/framework/depends_on.hpp:319:17: note: in instantiation of function template specialization 'boost::accumulators::impl::immediate_weighted_mean_impl<SNIP>' requested here
: Accumulator(args)
../../../boost/accumulators/framework/depends_on.hpp:252:29: note: in instantiation of function template specialization 'boost::accumulators::detail::accumulator_wrapper<SNIP>' requested here
return type(args, next_build_acc_list::call(args, fusion::next(f), l));
../../../boost/accumulators/framework/depends_on.hpp:252:56: note: in instantiation of function template specialization 'boost::accumulators::detail::build_acc_list<SNIP>' requested here
return type(args, next_build_acc_list::call(args, fusion::next(f), l));
../../../boost/accumulators/framework/depends_on.hpp:271:51: note: in instantiation of function template specialization 'boost::accumulators::detail::build_acc_list<SNIP>' requested here
return meta::make_acc_list<Sequence>::call(args, fusion::begin(seq), fusion::end(seq));
../../../boost/accumulators/framework/accumulator_set.hpp:159:21: note: in instantiation of function template specialization 'boost::accumulators::detail::make_acc_list<SNIP>' requested here
detail::make_acc_list(
valarray.cpp:150:78: note: in instantiation of function template specialization 'boost::accumulators::accumulator_set<SNIP>' requested here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/valarray:806:5: note: candidate constructor not viable: no known conversion from 'typename result<SNIP>' to 'const std::__1::valarray<double>' for 1st argument
valarray(const valarray& __v);
That last little bit makes it look like “result_type mean” is of type valarray<double> and boost is trying to pass a valarray<int> into its copy constructor and not succeeding.
I’ve narrowed down the offending code (in valarray.cpp) and this is the code that won’t compile:
typedef std::valarray<int> sample_t;
typedef boost::accumulators::statsboost::accumulators::tag::weighted_mean(boost::accumulators::immediate) mystats;
boost::accumulators::accumulator_set acc2;
Which is basically the same as:
sample_t s;
typedef boost::numeric::functional::multiplies::result_type weighted_sample;
typedef boost::numeric::functional::fdiv::result_type result_type;
result_type mean(s);
which also doesn’t compile and gives a pretty-much-identical error message.
I’m completely unfamiliar with the boost accumulators code, any suggestions on why this is failing, and what I can do to patch valarray.cpp so the regression test will compile?
Thanks,
Chris