Uenal Mutlu wrote:
"Victor Bazarov" wrote
Mr A wrote:
I'm trying to do the following:
emplate <typename Resource>
class ResourceManager
{
public:
typedef std::list<Resou rce*>::iterator Iterator;
typedef std::list<Resou rce*>::const_it erator ConstIterator;
Try
typedef typename std::list<Resou rce*>::iterator Iterator;
Visual Studio .NET doesn't like this.
Any ideas why? Is there a way around it?
I would say it is a compiler bug because both
typedef std::list<Resou rce*>::iterator Iterator;
typedef std::list<Resou rce*>::const_it erator ConstIterator;
should compile.
It should? According to what?
Anyway, if you think that it should compile, then you need to report a bug
to Comeau Computing because their compiler refuses to compile this:
----------------------------
#include <list>
template<class T> class R {
typedef std::list<T>::i terator Iterator; // ***************
std::list<T> l;
public:
R() {}
Iterator begin() { return l.begin(); }
};
int main() {
R<int> r;
r.begin();
}
-----------------------------
but compiles it fine if I change the line with asterisks to
typedef typename std::list<T>::i terator Iterator; // ********
(unless of course the culprit is the number of asterisks...)
V