Boost logo

Boost :

Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-08-16 09:33:12


On 08/16/13 06:00, Thorsten Ottosen wrote:
[snip]
>> - The classifier uses continuous storage in memory for objects of the
>> same type, therefore it is expected to improve cache efficiency with
>> respect
>> to solutions that use pointers (and new to allocate objects),
>> especially if the
>> client code uses some cache-aware allocator.
>
> I wanted to call my class template polymorphic_vector, taking base class
> and allocator template arguments. I imagined that the storage
> would be completely contigious, even when many different types of
> objects where stored into the container. This would give maximum cache
> efficiency.

Hi Thorsten,

I'm curious how you'd be able to store different types in contiguous
storage. I would guess the base class would have to have a virtual
derived_alignof and derived_sizeof methods which would
return alignof(Derived) and sizeof(Derived), and then the container
would use placement new and these virtual functions and a
container_buffer type std::vector<char> to figure out where
to place the next element in the container_buffer?

Since boost::fusion::vector<T1,T2,...,Tn> stores different
types, T1,T2,...,Tn in contiguous storage, I'm wondering
why not use boost::fusion::vector?
[snip]

-regards,
Larry


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