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.g...@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.

Reply via email to