From: Arno SchÃ¶dl (aschoedl_at_[hidden])
Date: 2008-09-01 03:53:19
> When stacking N difference_ranges, the size difference between "fat" and "lean"
> iterators is 2^N. Thus in fully generic code where you don't know anything about
> the stacking depth, even generating a single fat iterator carries a potentially
> exponential penalty.
> This fact makes me think that range is not merely a fancy name for a pair of
> iterators but a concept in its own right between containers and iterators.
> Generic algorithms must be written on the basis of ranges rather than iterators
> or take a significant performance hit.
To be fair, this hit could be avoided by storing the sub-iterators of the difference_iterator in their factored form, e.g., m_ittrav/m_ittravEnd would be stored as m_ittrav/m_ittravEnd/m_travcommon. But this would put a big burden on the compiler to optimize the frequent compose/decompose operations. For example:
*compose( m_ittrav, m_travcommon ) // common data not used at all
m_ittrav=decompose( ++compose( m_ittrav, m_travcommon ) ).first;
-- Dr. Arno Schoedl Â· aschoedl_at_[hidden] Technical Director think-cell Software GmbH Â· Invalidenstr. 34 Â· 10115 Berlin, Germany http://www.think-cell.com Â· phone +49-30-666473-10 Â· toll-free (US) +1-800-891-8091 Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl Â· Amtsgericht Charlottenburg, HRB 85229
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk