|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-06-04 16:33:23
> void AddUserAge( int& age )
> {
> ++age;
> }
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> std::vector<_sUserData> vUserData;
> for( int i = 0; i < 10; ++i )
> vUserData.push_back( _sUserData() );
> std::for_each( vUserData.begin(), vUserData.end(), boost::bind(
> AddUserAge, boost::bind( &_sUserData::m_nUserAge, _1 ) ) );
> return 0;
> }
This compiles in 1.33, but doesn't actually increment the age; the inner
bind returns a temporary int by value, and the outer bind increments that.
Can you please try boost::bind<int&>( &_sUserData::m_nUserAge, _1 ) and see
if it helps?
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