|
Boost : |
Subject: Re: [boost] Abstract STL Container Adaptors
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-03-18 11:07:28
On 18-03-2013 15:46, Nevin Liber wrote:
> On 18 March 2013 09:35, Nevin Liber <nevin_at_[hidden]> wrote:
>
>> On 18 March 2013 07:29, Thorsten Ottosen <thorsten.ottosen_at_[hidden]>wrote:
>>
>>> Its no different than using boost::function<>, that is, it allow us to
>>> make a generic interface with decisions deferred till run-time (at the
>>> expense of a performance loss).
>>>
>>
>> It isn't just *one* generic interface; the underlying iterators have to be
>> type erased as well.
>>
Sure. That has been done:
http://www.boost.org/doc/libs/1_53_0/libs/range/doc/html/range/reference/ranges/any_range.html
> To be completely generic, you may need to type erase allocator_type,
> pointer, const_pointer, reference, const_reference, size_type and
> difference_type (since they may all differ between containers, and many of
> those types now come from the underlying allocator), as well as have the
> ability to pass an allocator in for both holding the type erased container
> as well as any of the underlying type erased objects.
Well, I don't see a need for all the allocator stuff. What the point? Do
you have a similar need when using boost::function<> or boost::any?
reference/const_reference can be T& and T const&. Perhaps we don't need
pointer. One may choose a difference_type that is 64 bit to be generic.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk