|
Boost : |
Subject: Re: [boost] [iterator] why isn't there a mapped_type iterator adaptor in boost?
From: Christopher Schmidt (mr.chr.schmidt_at_[hidden])
Date: 2010-05-16 09:50:11
Am 15.05.2010 23:59, schrieb Neil Groves:
> I feel compelled to suggest caution at performing type-erasure at an
> iterator level. This would often be the wrong place to incur runtime
> overhead for compiler-time advantage. The deterioration in locality of data,
> the worsening of cache-line performance and reduced in-lining capability
> would often make this a poor design choice. Indeed there were a number of
> older library designs that used runtime polymorphism with iterator
> hierarchies that ultimately discovered that this approach was vastly
> inferior to the generic iterator approach of the standard library. However I
> can certainly see that this is useful across module interface boundaries for
> small collections etc.
[snip]
> Thank you for an interesting problem. I do wonder if it might be a good idea
> to provide a type-erasure Boost.Range adaptor so that you could write
> something like:
>
> map_instance | boost::adaptors::map_values |
> boost::adaptors::type_erased<int, boost::forward_traversal_tag>
>
> Is there much interest in using the library in this way? I'm happy to
> implement this if there is.
Yes, please. I would love to see a type-erased range and a type-erasing
adaptor - exactly for the reason you pointed out.
-Christopher
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk