Boost logo

Boost Users :

From: yinglcs2_at_[hidden]
Date: 2006-02-22 17:39:45


I have a function which takes a map (with int as key)
and put all keys into another vector:

void keySet2(map<int, string> aMap, vector<int>&
keySet) {
        transform( aMap.begin(), aMap.end(),
back_inserter(keySet), bind(&map<int,
string>::value_type::first, _1) );
}

But when I turn that find function into a template, I
have compile erro. So is it possible to use boost in a
template?

here is my code:
template <class T>
void keySet(T& aMap, vector<int>& keySet) {
        transform( aMap.begin(), aMap.end(),
back_inserter(keySet), bind(&T::value_type::first,
_1) );
        
}

here is the error:
g++ -O0 -g3 -Wall -c -fmessage-length=0
-oBlockGrouper.o ../BlockGrouper.cpp
../Utils.h: In function ‘void keySet(T&,
std::vector<int, std::allocator<int> >&)’:
../Utils.h:149: error: ‘_1’ was not declared in
this scope

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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