Please vote once and for good: range operations

Bill Baxter wbaxter at gmail.com
Thu Jan 29 00:39:32 PST 2009


On Thu, Jan 29, 2009 at 5:33 PM, Daniel Keep
<daniel.keep.lists at gmail.com> wrote:
>
>
> Bill Baxter wrote:
>> On Thu, Jan 29, 2009 at 4:11 PM, Daniel Keep
>> <daniel.keep.lists at gmail.com> wrote:
>>
>>>  nonEmpty      -- as Walter one espoused: negative = bad, positive = good :D
>>
>> I think that's exactly the kind of thing he meant to avoid.  Now you have
>>      if (!nonEmpty)  { /* don't not do nothing here */ }
>>
>> Hopefully you were just joking...
>>
>> --bb
>
> Thing is that most of the time, I'm more interested in testing to see if
> a container/sequence has something in it rather than has nothing in it.
>
> while( range.nonEmpty )
> {
>    doSomethingWith(range.front);
>    range.advanceFront;
> }
>
> I admit that nonEmpty is probably a bad name; I just couldn't think of a
> short and pithy way of saying 'has something in it.'  Then again, I
> don't want to start another war of semantics; it's not the end of the
> world :P

:-) Ok.    .more, .hasMore, .remains, .hasFront, something of that ilk
would do it then.

--bb



More information about the Digitalmars-d mailing list