Topic: Legal??? class A: public myclass<A> { ... }
Author: Oleg Zabluda <zabluda@math.psu.edu>
Date: 1998/05/21 Raw View
Alessandro Evangelista <s162996@studenti.ing.unipi.it> wrote:
: template <class T>
: class myclass {
: T& t;
: }
: class A : public myclass<A> {
: ..
: }
: I tried this with gcc 2.8.1 and it works !?!?
: Is it legal?
Yes, it's legal, often used, and even has a name:
something like -- "Curiously recurring derivation pattern"
or something.
Oleg.
--
Life is a sexually transmitted, 100% lethal disease.
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Michael Tsirkin <mtsirkin@iil.intel.com>
Date: 1998/05/21 Raw View
Alessandro Evangelista wrote:
> class A : public myclass<A> {
>
> Is it legal?
>
>
Yes, and MS ATL uses this everywhere, IDispatchImpl for example.
MST
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Alessandro Evangelista" <s162996@studenti.ing.unipi.it>
Date: 1998/05/18 Raw View
template <class T>
class myclass {
T& t;
}
class A : public myclass<A> {
..
}
I tried this with gcc 2.8.1 and it works !?!?
Is it legal?
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]