std.conv: conversion from ulong to enum
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Aug 22 18:54:45 PDT 2013
On Fri, Aug 23, 2013 at 03:37:11AM +0200, Andrej Mitrovic wrote:
> On 8/23/13, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> > Whether to() *should* attempt the conversion
> > is a different matter, though.
>
> to!() is used for save conversions, so it should try to convert and
> throw an exception if conversion fails. For example:
>
> byte x = to!byte(int.max);
>
> std.conv.ConvOverflowException at conv.d(1335): Conversion positive overflow
Alright, opened a new bug for this:
http://d.puremagic.com/issues/show_bug.cgi?id=10874
T
--
It is the quality rather than the quantity that matters. -- Lucius Annaeus Seneca
More information about the Digitalmars-d
mailing list