Re: Iterators in a subrange?

Discussion in 'C++' started by tom_usenet, Jul 1, 2003.

  1. tom_usenet

    tom_usenet Guest

    On Tue, 01 Jul 2003 12:57:48 GMT, (tom_usenet)
    wrote:

    >std::for_each(
    > v.begin() + start,
    > v.begin() + finis,
    > std::bind2nd(
    > std::mem_fun_ref(&X::sety),
    > 1000
    > )
    >);


    Ahh, that won't work unless you use the special <functional> header
    from the boost library, because of binders taking a const reference
    argument but setY being a non-const member function.

    boost::bind would be better anyway:

    std::for_each(
    v.begin() + start,
    v.begin() + finis,
    boost::bind(
    &X::sety,
    _1,
    1000
    )
    );

    Tom
     
    tom_usenet, Jul 1, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Sprague
    Replies:
    4
    Views:
    694
  2. Russ Perry Jr
    Replies:
    2
    Views:
    4,186
    Russ Perry Jr
    Aug 20, 2004
  3. Marcin Kaliciñski

    Iterators and reverse iterators

    Marcin Kaliciñski, May 8, 2005, in forum: C++
    Replies:
    1
    Views:
    498
    Kai-Uwe Bux
    May 8, 2005
  4. , India
    Replies:
    10
    Views:
    1,092
    James Kanze
    Aug 8, 2009
  5. seanovsky
    Replies:
    0
    Views:
    700
    seanovsky
    Nov 18, 2009
Loading...

Share This Page