Topic: typedefs and templates in class scope
Author: "Ralf Seidel" <no_spam_to_seidel3@uni-wuppertal.de>
Date: 1997/07/21 Raw View
On 10 Jul 1997 10:40:48 PDT, Nicholas John Walker wrote:
>I have been trying to find out if the following is legal C++ under
>current standard.
>
>template<class T>class TAnchor {/*...*/};
>
>class Boat {
>public:
> typedef TAnchor<Boat> Anchor; // is this OK?
> // more stuff, but no other reference to Boat::Anchor
>};
It is Ok
Ralf
----------------------------------------------------------------------
On reply please use the following address:
seidel3@uni-wuppertal.de
---
[ 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 ]
Author: Nicholas John Walker <njwalker@mint1.desy.de>
Date: 1997/07/10 Raw View
Greetings!
I tried to post this question a while back, but nothing appeared in the
news
group? I'm not sure why, so I'll try again.
I have been trying to find out if the following is legal C++ under
current
standard.
template<class T>class TAnchor {/*...*/};
class Boat {
public:
typedef TAnchor<Boat> Anchor; // is this OK?
// more stuff, but no other reference to Boat::Anchor
};
I've been trying to work out from the draft standard if this is OK, but
I'm just getting frustrated.
Thanks for any help,
Nick Walker.
--
|--------------------------------------------------------------------------|
| Nicholas John Walker email:
njwalker@mail.desy.de |
| MPY Group tel: +49
040-8998-4570 |
| DESY - Deuches Elektronen Synchrotron fax: +49
040-8994-4305 |
| Notkestr. 85
http://www-mpy.desy.de/njwalker |
| D-22607
Hamburg |
|--------------------------------------------------------------------------|
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: "(C) Chichiang Wan" <wanc@hpclear6.cup.hp.com>
Date: 1997/07/12 Raw View
Nicholas John Walker wrote:
>
>
> template<class T>class TAnchor {/*...*/};
>
> class Boat {
> public:
>
> typedef TAnchor<Boat> Anchor; // is this OK?
>
> // more stuff, but no other reference to Boat::Anchor
> };
>
> I've been trying to work out from the draft standard if this is OK, but
> I'm just getting frustrated.
>
Inside a class, class name is avaiable, and typedef something
somethingelse is OK for "soemthing" to be incomplete.
You can declare a member of type Anchor in Boat. This is soemthing
unique to class scope.
-- Chichiang
---
[ 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 ]