Reputation: 16286
I've never used Boost.Functional, only briefly read its documentation. Looks like it's an improvement to Standard <functional> header.
An example on the main page of Boost.Functional (Usage section) was chosen as an introduction to the library. The same can be done easier using Boost.Bind (or Boost.Lambda). Also, Boost.Bind is an excellent alternative to other tools from <functional> header.
I'm curious, is there anything from Boost.Functional or STL <functional> header that cannot be done by Boost.Bind? Or any other benefits of Boost.Functional?
Upvotes: 3
Views: 692
Reputation: 16690
If you look at http://www.boost.org/doc/libs/1_47_0/libs/functional/index.html, it says:
The header functional.hpp provides enhancements to the function object adapters specified in the C++ Standard Library (sections 20.3.5, through to 20.3.8). The enhancements are principally possible due to two changes:
- We use the Boost call_traits templates to avoid the problem of references to references, and to improve the efficiency of parameter passing.
- We use two function object traits class templates to avoid the need for ptr_fun with the adapters in this library.
Usage
Using these adapters should be pretty much the same as using the standard function object adapters; the only differences are that you need to write boost:: instead of std::, and that you will get fewer headaches.
No one uses "ptr_fun" anymore (when you have Boost.Bind), so that just leaves dealing with "references to references" Does that answer your question?
Upvotes: 2