Boost logo

Boost :

From: Bjarne Stroustrup (bs_at_[hidden])
Date: 2001-07-19 15:14:01


 
"Fernando Cacciola" <fcacciola_at_[hidden]> writes:
>
> In order to introduce this proposal let's consider the following situations:
>
> CASE A:
> =======
>
> struct image
> {
> ...
> int get_pixel( int x, int y) const ;
> ...
> } ;
>
> How should we deal with the case of x,y being outside the image?
> Unfortunately, it might be the case that every possible integer value is a
> valid pixel color, so no value can be used to signal that there is no pixel
> at that position.
> Assume that the function should not throw an exception.

Why/when is that a good assumption?

When used systematically, the "stateful" technique simulates on of the
techniques for implementing simple exceptions.

        - Bjarne
Bjarne Stroustrup, http://www.research.att.com/~bs


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