AMDG Joost Kraaijeveld wrote:
On Fri, 2010-02-05 at 07:50 -0800, Steven Watanabe wrote:
bind(&map
::insert, insert is overloaded and the compiler doesn't know which one you mean. You'll need to cast it to the right type. See also http://www.gotw.ca/gotw/064.htm
Based on your answer and the Boost lambda docs (http://www.boost.org/doc/libs/1_42_0/doc/html/lambda/le_in_details.html#lamb...) I changed the code to: ... template< typename Predicate > map
getObjectsFromMap( const Predicate& aPredicate) { pair< map< string, string >::iterator, bool > (*InsertFn)(const map ::value_type&) = &map ::insert;
Try pair<...> (map
map
matchedObjects; for_each( objectsMap.begin(), objectsMap.end(), if_then( bind(aPredicate, _1) , bind(InsertFn, &matchedObjects , make_pair(bind(&map ::value_type::first, _1),bind(&map ::value_type::second,_1))))); return matchedObjects; } But that gives me more errors than I could imagine. Could you give me a bit more info as I am really lost here.
In Christ, Steven Watanabe