Where are the template members?

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Wed Dec 5 01:43:41 PST 2012


Aren't the template instances generated at the place of the template?
The external code would instantiate the template, adding the instance
information to the structure.
Then the sizeof would just read the set of instantiated templates.
This wouldn't require knowing about the code which instantiates the
template.
The only requirement would be to compute the size of the structure AFTER
all template instances are generated.
The only limitation would be that separate compilation passes could
generate different structures due to different template instances, but
that's not a problem, because the static templates go through the same
limitation.



On Wed, Dec 5, 2012 at 1:11 PM, Timon Gehr <timon.gehr at gmx.ch> wrote:

> On 12/05/2012 10:06 AM, Gor Gyolchanyan wrote:
>
>> ...
>>
>>
>> Is there any good reason why this feature wouldn't be a good idea?
>> ...
>>
>
> Determining the size of a struct instance would require knowledge about
> all the code that uses the struct declaration.
>



-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121205/5e13688f/attachment.html>


More information about the Digitalmars-d mailing list