Advertisement

typedef question

Started by February 24, 2001 05:06 AM
3 comments, last by Zeblar Nagrim 23 years, 11 months ago
I want to use typedef to create a pointer to a class variable: typedef PSURFACE (CSurface *); This dosn´t work. Why? Zeblar Nagrim, Lord of Chaos
Don''t you mean...

typedef BuiltInType *MyType;


The other thing you need to remember is that built-in type has to be defined, even if you just do "class BuiltInType;"
Advertisement
Thanx, I forget the correct syntax...

Zeblar Nagrim, Lord of Chaos
I suppose I could stick a little typedef question in here myself too, actually it''s more about templates but what the heck...starting a new thread would be a waste...anyways all I''m asking is if anybody knows if this is valid ANSI C++:

  template<typename T>class std_allocator {public:  typedef size_t size_type;};template<typename T, typename A = std_allocator<T> >class my_class {public:  typedef A::size_type size_type;};  


gcc (2.95.2 as well as an older version, egcs 2.91.something-I-think) chokes on this code but I know MSVC is quite happy with it.


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album
Okay, nevermind, I found a way around it...It had that very suggesting in gcc''s error message..duh..
Doing a typename A::size_type size_type would solve it all, and have the same desired effect.


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album

This topic is closed to new replies.

Advertisement