Hi, Your compiler's first message is explanative:
Jonnster wrote:
I get the following: c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::vector<_Ty,_A> &,const class std::vector<_Ty,_A> &)' : could not deduce template argument for 'const class std::vector
Make it happy with:
std::vectorstd::string::iterator it = std::find(vecStrings.begin(), vecStrings.end(), sMax);
With C++0x (VS2010 or gcc 4.5) you can write:
auto it = std::find(vs.begin(), vs.end(), sMax);
which instructs the compiler to deduce the type of it. With previous compilers use typedef to get simpler code:
typedef std::vectorstd::string VS;
VS vs;
// populate vs
VS::iterator it = std::find(vs.begin(), vs.end(), sMax);
cheers, AR C++0x wording edited
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Friday, October 22, 2010 4:24 AM