Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-08-19 08:09:32
On 19-08-2013 01:49, Santiago Tapia wrote:
>>> - The container's name is classifier because it classifies objects
>>> internally using the RTTI.
>> I had similar ideas that I wanted to implement. I didn't expect to use
>> RTTI. Basically I wanted the class hierarchy's base class to derive from
>> a class with pure virtual functions that allowed the container to
>> perform the inplace-contruction, copying and alignment stuff.
> I am trying to make the interface of the container as easy as possible.
> I think using RTTI is an easy solution.
It's good to focus on an easy to use interface, but we should also
explore implementation strategies as these may affect the interface.
>> 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. Then if the user wanted to sort or otherwise manipulate the
>> sequence, he could just create an std::vector<T*> of the elements
>> (Thus, push_back should probably return a pointer to the constructed
> I am thinking about including that std:vector<T*> internally in
> another container,
> thus, I could provide a random access iterator. That could be
We don't need to include anything. We just need to allow forward
iteration via a singly linked list.
> But I see a problem: if we only sort the vector<T*> then the objects in memory
> of consecutive iterations will not be contigous in memory
> and we will lose some of the cache efficiency.
That's ok. The major benefit will come from the fact that objects are
not spread out all over the heap, but lies in contigious storage.
> I will try to provide another kind of iteration, actually a two-levels
> iteration, like in
> a matrix, in order to gain access to the vectors of objects. That way we might
> sort objects of the same type without drawbacks.
That's one possibility. I still think it would be better to persue the
100% contigious storage approach. It seems much simpler to use ...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk