std.conv checking if "to" will work

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 11 02:10:02 PDT 2014


On Thursday, 11 September 2014 at 08:58:09 UTC, Robert burner 
Schadek wrote:
> I like the "to" template a lot, but sometimes I want to make 
> sure beforehand that a call to it works. Is there anything in 
> phobos in missed to do that. And I don't want to try catch.

There's an open request for it, and plans to have a "bool 
maybeTo!(OUT, WHAT)(WHAT what, ref OUT out)", but we aren't quite 
there yet.

The idea is that *once* we have that, then "to" would simply 
become an "enforce!maybeTo".

But in the meantime, no. you have to trycatch.


More information about the Digitalmars-d-learn mailing list