boost bind question

This is a discussion on boost bind question within the C++ Programming forums, part of the General Programming Boards category; Hello I have a std::vector<boost::shared_ptr<someobject>> container, and I would like to call a function test(); on each object in a ...

  1. #1
    l2u
    l2u is offline
    Registered User
    Join Date
    May 2006
    Posts
    630

    boost bind question

    Hello

    I have a std::vector<boost::shared_ptr<someobject>> container, and I would like to call a function test(); on each object in a container..

    Whats that trick to do this boost::bind in one line so I dont have to use iteration for loop?

    Thanks a lot for help

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Quote Originally Posted by l2u View Post
    Hello

    I have a std::vector<boost::shared_ptr<someobject>> container, and I would like to call a function test(); on each object in a container..

    Whats that trick to do this boost::bind in one line so I dont have to use iteration for loop?

    Thanks a lot for help
    Same way you'd do it if it was a bare pointer. The magic of boost:

    Code:
    bind(&someobject::test, _1)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-12-2007, 05:45 AM
  2. building boost iostreams
    By l2u in forum C++ Programming
    Replies: 3
    Last Post: 04-14-2007, 02:29 PM
  3. Integrating Boost with STLPort
    By Mario F. in forum Tech Board
    Replies: 1
    Last Post: 11-11-2006, 05:49 AM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Simple Socket Question
    By SourceCode in forum Linux Programming
    Replies: 2
    Last Post: 06-22-2003, 09:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21