Boost logo

Boost :

From: Ullrich Koethe (koethe_at_[hidden])
Date: 2006-10-17 12:34:48


Lubomir Bourdev wrote:
>>The fact that GIL doesn't provide campling makes me argue it
>>is not a mature library. It's such a basic need (I get this
>>from reading the book!)
>>
>
>
> To clamp a channel in GIL you can just say:
>
> T channel;
> T clamped = std::min(channel, channel_max_value<T>());
>

But that's not how things work in practice. When the data are already
stored as type T, overflow has already occured. Moreover, the possibility
of overflow typically arises deep inside some algorithm, where you cannot
simply call std::min(), but need another mechanism (e.g. promotion traits).

Ulli

-- 
  ________________________________________________________________
|                                                                |
| Ullrich Koethe  Universitaet Hamburg / University of Hamburg   |
|                 FB Informatik        / Dept. of Informatics    |
|                 AB Kognitive Systeme / Cognitive Systems Group |
|                                                                |
| Phone: +49 (0)40 42883-2573                Vogt-Koelln-Str. 30 |
| Fax:   +49 (0)40 42883-2572                D - 22527 Hamburg   |
| Email: u.koethe_at_[hidden]               Germany             |
|        koethe_at_[hidden]                        |
| WWW:   http://kogs-www.informatik.uni-hamburg.de/~koethe/      |
|________________________________________________________________|

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