|
Boost : |
From: Vladislav Lazarenko (snail_at_[hidden])
Date: 2006-01-16 03:18:07
Is there any library to do thing like this more easily?
[code]
int x = -10;
int rating = std::max(std::min(x, 5), 0);
[/code]
As a result, we will have rating in range 0-5. I looked at the minmax library,
but looks like there is not such function :-? Maybe I am looking in a wrong way?
Thanks in advance,
Vladislav Lazarenko.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk