Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1005837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:21:41+00:00 2026-05-16T08:21:41+00:00

I am trying to implement a program which calculates the mean and moment by

  • 0

I am trying to implement a program which calculates the mean and moment by using the Boost library’s accumulator. Here is the code:

#include <iostream>

#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/moment.hpp>
using namespace  boost::accumulators;

int main()
{
    accumulator_set<double,stats<tag::mean,tag::moment<2> > >acc;
    //push  in some data
    acc(1.2);
    acc(2.3);
    acc(3.4);
    acc(4.5);
    std::cout<<"Mean  :  "<<mean(acc)<<std::endl;
    std::cout<<"moment : "<<accumulators::moment<2>(acc)<<std::endl;

    return 0;
}

But I get a long error list (listed below). Instead of accumulators I have tried boost::accumulator because at the line where I use the accumulator program it shows me a red line and after use of boost::accumulator a red line was hidden but errors are the same.
How can I fix this problem?

1>------ Build started: Project: examples, Configuration: Debug Win32 ------
1>Build started 8/20/2010 11:41:31 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\examples.unsuccessfulbuild".
1>ClCompile:
1>  examples.cpp
1>  using native typeof
1>c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(36): error C2027: use of undefined type 'boost::fusion::void_'
1>          c:\users\david\desktop\boost_1_44_0\boost\fusion\container\vector\vector_fwd.hpp(16) : see declaration of 'boost::fusion::void_'
1>          c:\users\david\desktop\boost_1_44_0\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::accumulators::detail::accumulator_set_result<AccumulatorSet,Feature>' being compiled
1>          with
1>          [
1>              AccumulatorSet=boost::accumulators::accumulator_set<double,boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>>,
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(57) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled
1>          with
1>          [
1>              C=boost::accumulators::detail::is_accumulator_set<boost::accumulators::accumulator_set<double,boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>>>,
1>              F1=boost::accumulators::detail::accumulator_set_result<boost::accumulators::accumulator_set<double,boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>>,boost::accumulators::tag::mean>,
1>              F2=boost::accumulators::detail::argument_pack_result<boost::accumulators::accumulator_set<double,boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>>,boost::accumulators::tag::mean>
1>          ]
1>          c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17) : see reference to class template instantiation 'boost::accumulators::detail::extractor_result<A,Feature>' being compiled
1>          with
1>          [
1>              A=boost::accumulators::accumulator_set<double,boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>>,
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(36): error C2146: syntax error : missing ';' before identifier 'type'
1>c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(36): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(36): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2893: Failed to specialize function template 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const Arg1 &) const'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          With the following template arguments:
1>          'boost::accumulators::accumulator_set<Sample,Features>'
1>          with
1>          [
1>              Sample=double,
1>              Features=boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A1 &) const' : expects 2 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(112) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &) const' : expects 3 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &) const' : expects 4 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &) const' : expects 5 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &) const' : expects 6 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &) const' : expects 7 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &) const' : expects 8 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &) const' : expects 9 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &) const' : expects 10 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &,const A9 &) const' : expects 11 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &,const A9 &,const A10 &) const' : expects 12 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &,const A9 &,const A10 &,const A11 &) const' : expects 13 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &,const A9 &,const A10 &,const A11 &,const A12 &) const' : expects 14 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &,const A9 &,const A10 &,const A11 &,const A12 &,const A13 &) const' : expects 15 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(17): error C2780: 'detail::extractor_result<Arg1,Feature>::type boost::accumulators::extractor<Feature>::operator ()(const AccumulatorSet &,const A0 &,const A1 &,const A2 &,const A3 &,const A4 &,const A5 &,const A6 &,const A7 &,const A8 &,const A9 &,const A10 &,const A11 &,const A12 &,const A13 &,const A14 &) const' : expects 16 arguments - 1 provided
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>          c:\users\david\desktop\boost_1_44_0\boost\accumulators\framework\extractor.hpp(148) : see declaration of 'boost::accumulators::extractor<Feature>::operator ()'
1>          with
1>          [
1>              Feature=boost::accumulators::tag::mean
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(18): error C2653: 'accumulators' : is not a class or namespace name
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(18): error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(679): could be 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(726): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,char)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(764): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(811): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,char)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(937): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const signed char *)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(944): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,signed char)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(951): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const unsigned char *)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(958): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,unsigned char)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(1085): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const std::error_code &)' [found using argument-dependent lookup]
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(186): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ostream<_Elem,_Traits> &(__cdecl *)(std::basic_ostream<_Elem,_Traits> &))'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(192): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(199): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::ios_base &(__cdecl *)(std::ios_base &))'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(206): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::_Bool)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(226): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(short)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(260): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned short)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(280): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(int)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(305): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned int)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(325): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(long)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(345): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned long)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(366): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(__int64)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(386): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned __int64)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(407): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(float)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(427): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(double)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(447): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(long double)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(467): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(const void *)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(487): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_streambuf<_Elem,_Traits> *)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          while trying to match the argument list '(std::basic_ostream<_Elem,_Traits>, overloaded-function)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>c:\users\david\documents\visual studio 2010\projects\examples\examples\examples.cpp(18): error C2676: binary '<<' : 'boost::accumulators::accumulator_set<Sample,Features>' does not define this operator or a conversion to a type acceptable to the predefined operator
1>          with
1>          [
1>              Sample=double,
1>              Features=boost::accumulators::stats<boost::accumulators::tag::mean,boost::accumulators::tag::moment<2>>
1>          ]
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:07.38
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:21:42+00:00Added an answer on May 16, 2026 at 8:21 am

    You probably need

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

    However, building the same example on Mac OS X and getting the following error:

    **** Build of configuration Debug for project Accumulators ****
    
    make all 
    Building file: ../src/Accumulators.cpp
    Invoking: GCC C++ Compiler
    g++ -I/opt/local/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Accumulators.d" -MT"src/Accumulators.d" -o"src/Accumulators.o" "../src/Accumulators.cpp"
    ../src/Accumulators.cpp: In function 'int main()':
    ../src/Accumulators.cpp:22: error: 'accumulators' has not been declared
    ../src/Accumulators.cpp:22: error: no match for 'operator<<' in 'acc << std::endl'
    make: *** [src/Accumulators.o] Error 1
    

    Then I changed accumulators::moment<2>(acc) to just moment<2>(acc) and it build ok. Code looks like below:

    #include <iostream>
    #include <boost/accumulators/accumulators.hpp>
    #include <boost/accumulators/statistics/stats.hpp>
    #include <boost/accumulators/statistics/mean.hpp>
    #include <boost/accumulators/statistics/moment.hpp>
    using namespace boost::accumulators;
    
    int main()
    {
        // Define an accumulator set for calculating the mean and the
        // 2nd moment ...
        accumulator_set<double, stats<tag::mean, tag::moment<2> > > acc;
    
        // push in some data ...
        acc(1.2);
        acc(2.3);
        acc(3.4);
        acc(4.5);
    
        // Display the results ...
        std::cout << "Mean:   " << mean(acc) << std::endl;
        std::cout << "Moment: " << moment<2>(acc) << std::endl;
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am trying to implement a Java program which sends an Apple Push Notification to
trying to implement a dialog-box style behaviour using a separate div section with all
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
All I am currently trying implement something along the lines of dim l_stuff as
Am trying to implement a generic way for reading sections from a config file.
I am trying to implement string unescaping with Python regex and backreferences, and it
I'm trying to implement a data compression idea I've had, and since I'm imagining
I'm trying to implement something like this: <div> <table> <thead> <tr> <td>Port name</td> <td>Current
We are trying to implement a REST API for an application we have now.
I am trying to implement a software Null Modem . Any suggestion how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.