Hi All,
The problem is that I want to disable the use of boolean type. But this is not possible with contract programming or otherwise. Actually, it's possible to fix it with contract programming or otherwise throwing errors.
alias ir = inclusiveRange;
auto inclusiveRange(T = int)(T f = T(0), T l = T(0), T s = T(1))
in(!is(T == bool), "Boolean type cannot be used!") {/*
{
static if(is(T == bool))
{
import std.format;
assert(false, format("This type (%s) cannot be used!", typeid(T)));
}//*/
if(!l) {
l = f;
f = 0;
}
return InclusiveRange!T(f, l, s);
} /* Error:
* operation not allowed on `bool` `this.last -= this.step`
*/
However, the compiler catches other errors! How can I solve this problem?
Thanks...
SDB@79