Hi group!

I try to call in a for_each a member function that take a parameter by value AND const. I know we do not need to do things like that, but I am using code from an other team and I don't want to change it if I don't need. It results with this error :    
D:\ENG-AC\working\tests\test_ParamConst_vs_boostBind\test\test.cpp(35) : error C2665: 'bind' : none of the 2 overloads can convert parameter 1 from type 'int (__thiscall test_class::*)(const int) const'

Here a little program that reproduce de behavior :

#include <algorithm>
#include <vector>
#include "boost/bind.hpp"

class test_class
{
public:
    test_class(int value) : m_value(value){}
    ~test_class(){}
   
    int fct_param_const(const int value) const {return m_value + value;}
    int fct_param_ref_const(const int& value) const {return m_value + value;}
    int fct_param(int value) const {return m_value + value;}

private:
    int m_value;
};

int main(int argc, char* argv[])
{
    std::vector<int> all_values(5);   
    std::generate(all_values.begin(), all_values.end(), &rand);

    test_class doTest(28);

    std::for_each(all_values.begin(), all_values.end(), boost::bind(&test_class::fct_param, doTest, _1));
    std::for_each(all_values.begin(), all_values.end(), boost::bind(&test_class::fct_param_ref_const, doTest, _1));
   
    // DOESN'T WORK : because of the parameter by value and const???
    //std::for_each(all_values.begin(), all_values.end(), boost::bind(&test_class::fct_param_const, doTest, _1));

    return 0;
}

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.

Regards,

--
Alain Cormier
alain.work@gmail.com