Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-24 12:20:44

Pavol Droba <droba_at_[hidden]> writes:

> An example: generic trim algorithm.
> <example>
> a) variant 1:
> template<typename OutputIteratorT, typename InputContainerT, typename PredicateT>
> OutputIteratorT trim_copy(
> OutputIteratorT Output,
> const InputContainerT & Input,
> PredicateT IsSpace);
> -Basic exception guarantie of this algorithm is give iff following operations
> give this guarantie:
> InputContainerT::const_iterator::operator++
> ::operator*

You can eliminate most of this mess by giving the requirement that
all operations give the basic guarantee. In fact, you don't actually
need to say it: if an operation doesn't preserve invariants, well,
then, they weren't invariants to begin with, were they? That's what
the C++ standard does.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at