Thread: boost bind question

  1. #1
    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
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    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, 06: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, 06: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