Dear all,
I am too tired to investigate it deeply, so does anyone know why this does not
compile (on VS 2003):
typedef boost::function
On Tue, 6 Dec 2005, gast128 wrote:
Dear all,
I am too tired to investigate it deeply, so does anyone know why this does not compile (on VS 2003):
typedef boost::function
BinOperand; typedef std::vector<BinOperand> BinOperandVector; BinOperandVector operands = boost::assign::list_of(std::plus<int>()) (std::minus<int>()) (std::multiplies<int>()) (std::divides<int>());
That's because the first time you call list_of, it's argument is of type std::plus<int>, and this binds the 'assignment object' to that type only. Thus all other calls to operator() expects arguments of the same type. The solution is to explicitly give the argument type to list_of as BinOperand like this: BinOperandVector operands = boost::assign::list_of<BinOperand>(std::plus<int>()) (std::minus<int>()) (std::multiplies<int>()) (std::divides<int>()); -- François Duranleau LIGUM, Université de Montréal "When there are others, I can perceive myself as an individual. If I am alone, then I will be the same as everything else. There will be no difference between myself and nothing!" - from _Neon Genesis Evangelion_
gast128 wrote:
Dear all,
I am too tired to investigate it deeply, so does anyone know why this does not compile (on VS 2003):
typedef boost::function
BinOperand; typedef std::vector<BinOperand> BinOperandVector; BinOperandVector operands = boost::assign::list_of(std::plus<int>()) (std::minus<int>()) (std::multiplies<int>()) (std::divides<int>());
Please post complete examples to make it easier to investigate suh things. Anyway, if you don't tell list_of() what type to store in the list, it will use the first argument to deduce the type. So you're creating a list of std::plus<int> ! do boost::assign::list_of<BinOperand>( .... ) instead HTH Thorsten
Thorsten Ottosen
Please post complete examples to make it easier to investigate suh things.
Ok forgot to put void Foo() {<snippet>} around it...
Anyway, if you don't tell list_of() what type to store in the list, it will use the first argument to deduce the type. So you're creating a list of std::plus<int> !
do
boost::assign::list_of<BinOperand>( .... )
instead
HTH
Thorsten
Thx (also for the previous post with the same solution). I will try it tomorrow. Wkr, me
participants (3)
-
François Duranleau
-
gast128
-
Thorsten Ottosen