From: Martin Bosticky (mbosticky_at_[hidden])
Date: 2002-11-22 09:28:28
I have I not a template boost guru but i have developed a 'functor adapter'
that I think could be usefull. To best of my knowledge the following is
currently not provided by boost library yet. Please let me know otherwise.
Functor adapter: adaptor2ndArgument and other appropriate variants can take
a functor, and create a new functor with a new argument type such that it
takes an object but uses that objects member. This would be usefull when you
want to search a container of some object type based on one of its member
data/functions. Normally the same affect can be achieved by writing custom
functors but that can get very tedious.
would convert the equal_to<string> binary_function with argumenst of type
into a new functor with arguments of type (string, object_type) such that
equal_to<string> gets called with arguments (what_ever_string,
// Find the preffered option
vector<Option>::iterator AVector_it =
// Identify when Option.vm_Member == "c"
By the way, i have attempted to find a solution that does not require the
template argument <Option> at all. However that does not copile on VC7. My
example compiles on VC6 and VC7.
It might be that there are other solutions available on boost already and
please let me know. However I suspect that those would not compile on lesser
compilers such as VC6.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk