std.conv: conversion from ulong to enum

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Aug 22 18:37:11 PDT 2013


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


More information about the Digitalmars-d mailing list