I have the following template definition
template<class T> inline T& at(std::vector<T>& v, int pos)
{
#ifdef _MSC_VER
return v.at(pos);
#endif
return v[pos];
}
and is instantiated as below
at(hasMUCVector,mucTag)=true;
where the type information is:
std::vector<bool> hasMUCVector;
int mucTag;
However I am unable to compile the code (g++ v 3.3.1 under Cygwin) and
it reports the following error.
error: could not convert `std::vector<bool,
_Alloc>::operator[](unsigned int) [with _Alloc =
std::allocator<bool>](pos)'
to `bool&'
Any ideas what the problem might be? As an aside if I change the
template definition to
template<class T> inline std::vector<T>::reference at(std::vector<T>& v,
int pos)
{
#ifdef _MSC_VER
return v.at(pos);
#endif
return v[pos];
}
the compiler generates a warning about something being deprecated but
does not flag an error.
Thanks,
Ravi.