Function failEnforce

Calls fail() if the condition is false.

This is much like std.exception.enforce(), but for for fail() instead of arbitrary exceptions.

Prototype

void failEnforce(T...)(
  bool cond,
  T args
);

Example

failEnforce(brokenSquareRoot(4)==2, "Reality broke! Expected 2, not ", brokenSquareRoot(4));

// Output on DMD 2.065 and up:
// yourProgramName: ERROR: Reality broke! Expected 2, not 555

// Output on DMD 2.064.2:
// yourProgramName: ERROR: Reality broke! Expected 2, not 555
// scriptlike.fail.Fail

Authors

Nick Sabalausky

Copyright

Copyright (C) 2014-2015 Nick Sabalausky

License

zlib/libpng