[challenge] Bounded types

Philippe Sigaud philippe.sigaud at gmail.com
Mon Oct 11 18:37:25 PDT 2010


On Mon, Oct 11, 2010 at 03:55, Yao G. <yao.gomez at spam.gmail.com> wrote:
> On Sun, 10 Oct 2010 16:16:05 -0500, Philippe Sigaud
> <philippe.sigaud at gmail.com> wrote:
>
> I don't have a bounded type, but a wrapping integer, ported from Boost:
>
>>
>> http://bitbucket.org/gomez/yao-library/src/tip/src/yao/datetime/core.d#cl-551

Wow, I never put pure nothrow around my constructors. Maybe I should.

The wrapping behaviour is interesting. All this could be ported into a
policy. It's a bit liki clipping a texture, what kind of possibility
do we have?

- throwing an exception
- asserting
- wrapping around
- clipping (if > max, then max. if < min, then min)
- taking a default value, maybe an OutOfBound state.

I'm also interested by your IntAdapter (aka int + infinity), I did
something similar once, to allow for slicing on infinite ranges.

Philippe


More information about the Digitalmars-d mailing list