Does anyone know of any libraries that can be used in place of Boost::Function and Boost::Bind? We are trying to remove our dependency on Boost since it's a pretty large library. We're looking for something more focused.
I found this: http://www.codeproject.com/KB/cpp/fastdelegate2.aspx
I've never used it though and it looks like it was last updated in 2007. Has anyone used it?
We use callbacks are fair amount throughout our code and boost::function and boost::bind allow us to do so. But we've run into problems turning RTTI and exceptions off using Boost. So any replacements would need to be usable with RTTI and exceptions turned off.
Thanks!
The implementation that you pointed to is built upon undefined behavior according to the standards. Disabling exceptions should be no problem with Boost.Function, as long as you define your own throw_exception function. And I'm sure disabling RTTI won't be a problem either, since Boost.Function goes through great trouble to avoid virtual functions at all (its all explained in its rationale). There are problems with disabling exceptions and RTTI for some Boost libraries, but Function and Bind are not the case, I have been using them in Android NDK with disabled exceptions and RTTI for a long while.
As for alternatives, you could always use the now standard C++11 ones (based on Boost) which are already available in several compilers; or you could always roll your own. There is also an alternative implementation of Boost.Function by Domagoj Saric, but I cannot seem to find pointers to it right now.
Check out Boost bcp tool, to extract only the files related to Function and Bind, and roll on your own version of them. You shouldn't need to change anything for them to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With