Boost logo

Boost Users :

From: Brian Allison (brian_at_[hidden])
Date: 2005-06-30 06:42:10


  Hi All,

  Given two vector<Rec*> S.T. :
    vector<Rec*> src;
    vector<Rec*> dst;

  Where 'src' has some elements that are useful, is there a more succint
way to say:

    for_each(src.begin(), src.end(),
             if_then( bind<bool>(&vector<Rec*>::empty, &var(dst)),
                       bind<void>(&vector<Rec*>::push_back, &var(dst),
_1) ) );

  Originally I tried using the member pointer operator, but this it gave
me compile fits (Red Hat with a 2.4.20-8 kernel, GCC 3.4.3) with this:

    for_each(src.begin(), src.end(),
             if_then(bind<bool>(&vector<Rec*>::empty, &var(dst)),
                     (&var(dst) ->* &vector<Rec*>::push_back)(_1)
                 )
             );

  Is that a valid use of the member pointer operator?

Thanks,
Brian


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