mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 15:10:46 +03:00
13 lines
550 B
Text
13 lines
550 B
Text
std.exception.enforce can now be used as an eponymous template to create your own enforce function
|
|
|
|
$(REF enforce, std,exception) now mirrors the behavior of $(REF enforceEx, std,exception)
|
|
and can be used as an eponymous template:
|
|
|
|
---
|
|
import std.conv : ConvException;
|
|
alias convEnforce = enforce!ConvException;
|
|
assertNotThrown(convEnforce(true));
|
|
assertThrown!ConvException(convEnforce(false, "blah"));
|
|
---
|
|
|
|
With this change, $(REF enforce, std,exception) is a strict superset of $(REF enforceEx, std,exception), which will be deprecated in 2.079.
|