Boost logo

Boost Users :

Subject: [Boost-users] boost::bind/boost::function and fast delegates
From: Littlefield, Tyler (tyler_at_[hidden])
Date: 2013-01-21 14:22:23


hello all:
We have a project we're working on that will be distributed, and I
didn't want to have to set boost as a dependency if we're only using
boost::bind and boost::function. Given this, I had a couple steps.
First I thought I could possibly just copy out the code and modify it a
bit, but it uses a ton of boost::preprocessor, so that'd require copying
that out too. I'd rather not imbed half of boost in the project.
My other solution (and one I really like) was to write my own delegates.
I set to work on this and it's coming out good, but I have a couple
questions.
I know you can assign function pointers to boost::function objects,
though I've always done it through bind. I'm curious how this works though:
I have a normal function pointer set up and working right now, but how
does boost::function take other pointers (say to static methods)?
Also I'm curious what boost::bind generates. I'd like to create my own
version since I love using it to pass in arbitrary values/using
placeholders, but the boost::function has to be able to take a newly
constructed function object and bind to that from what I understand. The
new function object somehow has it's arguments stored on the object so
that the () operator can just pass those in.
Any help here would be appreciated.
Thanks,

-- 
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.

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