|
Boost : |
Subject: Re: [boost] the best possible c++ properties (implementation).
From: James Porter (porterj_at_[hidden])
Date: 2010-03-01 16:00:57
On 3/1/2010 2:10 PM, Christopher Jefferson wrote:
>> Presumably each "int" now has 2 member function pointers. Thus 4 bytes becomes 20 bytes (best case, 64 bit ptrs) and more on
>> compilers that have bigger member function pointers.
>
> What exactly do you mean?
In order for a property ("Age" in the original example) to be able to
reference other properties/members of its containing class, it needs a
pointer to the object containing it.
But now that I re-read Daniel's message, maybe he's suggesting that
you'd have to have:
struct foo {
int data;
int (*getter)();
void (*setter)(int);
};
which is certainly unnecessary if you're being smart with templates.
- Jim
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk