Re: class containing a list of itself
From: Rob Williscroft (rtw_at_freenet.co.uk)
Date: 08/25/04
- Next message: Howard: "Re: memory corruption while debugging"
- Previous message: Howard: "Re: memory corruption while debugging"
- In reply to: Sharad Kala: "Re: class containing a list of itself"
- Next in thread: tom_usenet: "Re: class containing a list of itself"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Aug 2004 14:34:22 GMT
Sharad Kala wrote in news:2p3lcbFfv27rU1@uni-berlin.de in comp.lang.c++:
>> But your code will
>> be non-standard until/unless the standard gets changed.
With hindsight I should have possibly been clearer that the requirment
for completeness of argument types, is only for instantiation *not*
for declaration:
#include <list>
struct X;
extern std::list< X > xlist;
struct X {};
std::list< X > xlist;
>
> I think Standard does mention about this in Section 14.3.1/2
> " ...[Note: a template type argument may be an incomplete type. ] "
>
14.3.1 == Templates / Template type arguments.
Not really relevent to wether or not std::list< T > can take
an incomplete T and be instantiated *before* T is complete.
IOW: you can always (*) declare a specialization which has an incomplete
argument type, what is dependant on the template defenition is wether
you can instantiate such a specialization.
*) Unless such a declaration requires instantition of an
un-instantiatable specialization:
template < typename > struct empty {};
template < typename T, typename U = typename empty< T >::type >
struct no
{
};
extern no< int > nope;
Rob.
-- http://www.victim-prime.dsl.pipex.com/
- Next message: Howard: "Re: memory corruption while debugging"
- Previous message: Howard: "Re: memory corruption while debugging"
- In reply to: Sharad Kala: "Re: class containing a list of itself"
- Next in thread: tom_usenet: "Re: class containing a list of itself"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|