handful and interval
Jonathan M Davis
jmdavisProg at gmx.com
Sun Sep 2 21:56:37 PDT 2012
On Sunday, September 02, 2012 21:47:13 Walter Bright wrote:
> On 9/2/2012 4:40 PM, Andrei Alexandrescu wrote:
> > On 9/2/12 10:24 PM, Walter Bright wrote:
> >> On 9/2/2012 7:45 AM, Andrei Alexandrescu wrote:
> >>> On 9/2/12 4:22 PM, Andrei Alexandrescu wrote:
> >>> [snip]
> >>>
> >>> The alternative would be to simply define these as functions:
> >>>
> >>> if (a.among("struct", "class", "union")) { ... }
> >>> if (b.between(1, 100)) { ... }
> >>
> >> Is between inclusive or not of the endpoints?
> >
> > After quite a bit of thought, I think inclusive is the right way.
>
> Then there's no way to specify an empty interval. I suppose with "between"
> that would not be relevant.
It could take a std.aglorithm.openRight as its third, parameter, then you
could choose to do one or the other. It just becomes a question of which is
the default.
Certainly, my natural inclination is to go with having intervals be open on
the right, but if you have a choice, it's less of an issue regardless of which
is the default.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list