Boost logo

Boost Users :

Subject: [Boost-users] [boost::numeric::functional::plus_base] Why the arguments are not const reference
From: Kan Li (likan_999.student_at_[hidden])
Date: 2010-04-01 04:23:58


It seems like the operators define in boost::numeric::functional takes
reference as argument instead of const reference. Which makes it compile
error if I use

boost::numeric::functional::plus<int, int> op;
int n = op(1,1);

The way to work around is

boost::numeric::functional::plus<const int, const int> op;
int n = op(1,1);

This is very ugly and not makes much sense, compared to std::plus. So is it a
design flaw or is there some other reason for designing it in this way?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net