Boost logo

Boost Users :

From: tom gee (rockonedge_at_[hidden])
Date: 2005-01-16 22:21:13

Here is the work around:
class A
    typedef struct _ONE_RECORD_
        string sGUID;
        string sID;
        string sName;
        string sSupport;
        string sModify;

    vector<ONE_RECORD> m_v;

    void FillOneLine(const ONE_RECORD& one_line);
    void FillAllLines();

void A::FillAllLines()
   // method 1
    for_each(m_v.begin(), m_v.end(), boost::bind(&A::FillOneLine,
this,_1)); // OK
   // method 2
    for_each(m_v.begin(), m_v.end(), boost::bind(&A::FillOneLine,
this, ref(_1))); // error

Since ONE_RECORD can be large, I prefer to calling bind() as method
2, but, compiled under VC7.1 it generates such an error:

e:\Boost\include\boost-1_32\boost\bind.hpp(285): error C2664: 'R
boost::_mfi::mf1<R,T,A1>::operator ()<A>(U & ,A1) const' : cannot
convert parameter 2 from 'boost::arg<I>' to 'A::ONE_RECORD'
            U=A *
 Can any body help to explain why and give a solution? Thanks.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at