I have a function which takes a map (with int as key)
and put all keys into another vector:
void keySet2(map aMap, vector<int>&
keySet) {
transform( aMap.begin(), aMap.end(),
back_inserter(keySet), bind(&map::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&)â:
../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