
Alain Cormier wrote: [...]
int fct_param_const(const int value) const { return m_value + value; }
[...]
Is this a correct behavior from boost::bind? Does the only solution is to remove the const from our function? We have so much difficulty to stay const-correct, I do not want to send a signal to our team that const isn't good (but maybe too much const isn't good :D). Anyway, what do you suggest?
By the way. I am using VC6 (SP5) under Win2000 and boost 1.33.1.
This is a bug in VC6, see http://boost.org/libs/bind/bind.html#err_const_arg Top-level const in a function argument list is a peculiar thing. It is ignored for the purposes of the function signature, so void f( int const ); and void f( int ); actually declare the same function, and there is no such thing as void (*)( int const ), the correct type is void (*) ( int ). Such a const qualifier is only relevant on a function definition and makes the actual argument const. It has no impact on the const correctness of the caller side since a by-value parameter cannot affect the argument. boost::bind can do nothing about the fact that VC6 is confused by such functions, except maybe to encourage you to upgrade. :-)