Any word on the return-type const syntax? [OT]

guslay guslay at gmail.com
Sun Dec 9 10:58:44 PST 2007


Bill Baxter Wrote:

> Sean Kelly wrote:
> >> Template member functions are not instantiated until they are called.
> > 
> > Or until they are aliased, to be pedantic.
> 
> It's an important point though.  Does C++ behave that way?  I was under 
> the impression that in C++ I could create typedefs of templated structs 
> and classes that wouldn't get instantiated unless actually used.


Instantiation is not required with typedef, because the following is legal C++
 class Foo;
 typedef vector<Foo> vfoo_t; // 1

but not 
 vector<Foo> vfoo; // 2 - cannot instantiate 

I don't know however if an implementation *would* instantiate //1 if it *could* (ie. if Foo was defined).





More information about the Digitalmars-d mailing list