Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-05-15 13:31:24


On 05/15/2006 07:49 AM, David Abrahams wrote:
> Joel de Guzman <joel_at_[hidden]> writes:
>
>>David Abrahams wrote:
[snip]
>>>Seems to me a vector can't do as well as some other structures when
>>>many of the elements of the tuple are empty classes.
>>
>>In terms of memory footprint?
>
> Yes.
>
Isn't the list<T0,T1,T2,...> memory the same as that of:

   struct
   { T0 car;
     struct
     { T1 car;
       struct
       { T2 car;
         struct
         {
         ...
         } cdr;
       } cdr;
     } cdr;
   };

and the vector<T0,T1,T2,...> memory the same as that of:

   struct
   { T0 m0;
     T1 m1;
     T2 m2;
     ...
   }

? If so, what's the reason the memory footprints would be different?
If not, could you explain what is the footprint, preferably using
some struct counterpart like those above?

TIA.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk