Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2004-07-18 00:16:49


David Abrahams wrote:
> [...]
> Very bad idea. There's no reason that the algorithm should give up
> the basic guarantee in that case. Consider:
>
> template <class InputIterator>
> std::vector::assign(InputIterator,InputIterator)
>
> That really gives the basic guarantee with no hidden assumptions.

It assumes that there are no invariants that require, for instance,
that all the input is consumed.

> [...]
> In case you think this is an "evil glossing over of detail",

I wouldn't call it "evil"...

> there are actually lots of these assumptions lurking in standard
> requirements, but they still work very well. For example, if
> incrementing InputIterator actually had the side-effect of modifying
> the vector, how well do you think std::vector::assign would work?
> How understandable do you think the specification would be if all
> these kinds of details were actually spelled out?

...but I guess it's the difference between a theorist and an engineer.
As a little of both, I would like to simultaneously argue for rigor
and pragmatism. ;)

Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk