
AMDG Eric Niebler <eric <at> boost-consulting.com> writes:
My point is, the phrase "if you want buffering" doesn't make any sense. The user (or generic algorithm) doesn't know and shouldn't care what the optimal insertion strategy for a given series type is.
Is there any data structure for which buffering actually helps?
Let's back up. Why do you believe that
back_insert (v1, from1, to1) back_insert (v2, from2, to2) back_insert (v3, from3, to3)
should be lower-level than
begin transmission back_insert (v1, from1, to1) back_insert (v2, from2, to2) back_insert (v3, from3, to3) end transmission
?
It is possible to implement either in terms of the other so in a sense neither one is intrinsically "lower-lever." The first is simpler. I do not think the second gains enough flexibility to justify the added complexity. I've just been running some tests with binary trees and the results are surprising. Neither msvc 8.0 nor gcc 3.4 implement the range insertion in linear time for sorted ranges (In spite of the standard). Both just do an element by element insert. Second, I discovered that the map_back_inserter I posted is as fast as a buffered version ( the buffering is insignificant, BTW). In Christ, Steven Watanabe