Topic: Member typedef access
Author: "Paul D. DeRocco" <strip_these_words_pderocco@ix.netcom.com>
Date: 1997/05/03 Raw View
Has any consideration been given to allowing member typedefs to be
accessed using . or -> on an object or pointer, instead of :: on the
class name? (A crude analogy can be drawn between this and the way
sizeof can be applied to an object, even though it doesn't actually
access the object.) It seems to me that it might be feasible to
incorporate this into the syntax now that we have a "typename" keyword,
along the lines of:
template <class X> class T {
typedef X othertype;
};
T<int> t;
typename t.othertype x; // declares an int
This, or something like it, might come in handy in certain uses of
templates, although, being fairly inexperienced with the more extreme
uses of templates, I'm not sure there aren't alternatives that I haven't
discovered. Any comments?
--
Ciao,
Paul
(Please send e-mail to mailto:pderocco@ix.netcom.com instead of the
return address, which has been altered to foil junk mail senders.)
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]