www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: safer casts - take II

reply terranium <spam here.lot> writes:
Janice Caron Wrote:

 We already have that.
 
     import std.conv;
 
     dst = to!(T)(src);
 
 so your base is already covered.

May 13 2008
parent "Janice Caron" <caron800 googlemail.com> writes:
On 13/05/2008, terranium <spam here.lot> wrote:
 just what I wrote about
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=71725

Seriously - to!(T) is the D standard way of doing convertions that will throw an exception on failure. It is the right function for dynamic-cast-with-throw.
May 13 2008