[challenge] Bounded types
Philippe Sigaud
philippe.sigaud at gmail.com
Mon Oct 11 18:30:27 PDT 2010
2010/10/11 Adam D. Ruppe <destructionator at gmail.com>:
> For future direction, I don't think the Type argument is actually needed to the
> Bounded struct. It could determine it from the bounds.
>
> So Bounded!(0, 255) it knows could be a ubyte, but Bounded!('A', 'Z') is a char.
>
> Maybe the type param can be moved to the end, as an optional parameter. In most
> cases, it should be able to figure it out on its own.
Good point. That'd make for cleaner code, but there are cases where
you want to specify the underlying/implicit cast type, such as
int/uint or int/short/byte.
More information about the Digitalmars-d
mailing list