From: James Jennings on
The template in the code below is from "The C++ Programming Language,
Special Edition, Bjarne Stroustrup (c)2000, page 53. I used it in a
program I wrote several years ago, and it compiled with no problem.

I recently downloaded the Quincy 2005 C/C++ IDE. The MingW compiler that
Quincy uses gives the errors shown below the code. I set the compiler to
use "strict ANSI/ISO compliance". If I do not use "strict compliance",
and use a -fpermissive comiler option, the code will compile, albeit
with the same error messages.

I am vague on Templates and the C++ standard library. I would appreciate
it if someone can tell me: what is wrong?, how do I fix it?, and where
can I read up on this subject.

#ifndef NFLSEASZ_HPP
#define NFLSEASZ_HPP
// NFL/nflseasz.hpp
#include <vector>
#include <string>
#include <map>

template<class T> class Vec : public std::vector<T> {
public:
Vec() : std::vector<T> () { }
Vec(int s) : std::vector<T>(s) { }
T& operator[] (int i) {return at(i);} // line 12
const T& operator[] (int i) const {return at(i);} //line 13
};

The compile messages include:

Checking dependencies
....
nflseasz.hpp:12: error: there are no arguents to 'at' that depend on a
template parameter, so a declaration of 'at' must be available
nflseasz.hpp: In member function "const T& Vec<T>::operator[](int) const':

There are similar error messages for line 13.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]