Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-28 00:44:39


"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> "Pavol Droba" <droba_at_[hidden]> wrote in message
> news:20031026155020.GG17011_at_lenin.felcer.sk...
>> On Mon, Oct 27, 2003 at 02:07:47AM +1100, Thorsten Ottosen wrote:
>
>> > You also called your functions firnd_first, not find_0th, and we have
>> >
>> > find_first( s, XX ) == find_nth( s, XX, 0 )
>> >
>> > which doesn't seem natural. It's like having an integer variable and
> making
>> > zero mean you have got one
>> > of something.
>> >
>>
>> What would then denote find_nth( s, XX, 0 )? Should it throw an exception?
>
> a good idea. the argument could be an int and you could prevent [-max_int,0]
> as input.

You can prevent that easily enough by using an unsigned and doing
range checking on the upper bound.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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