Type Parameter Deduction
Salih Dincer
salihdb at hotmail.com
Tue May 10 15:40:56 UTC 2022
On Tuesday, 10 May 2022 at 14:42:31 UTC, Ali Çehreli wrote:
> What would you like to see instead? [...]
Here that is:
```d
void inclusiveRange(T)(T Args...) if(is(T == bool)) {
assert(0, "\nBoolean type cannot be used!");
}/*
core.exception.AssertError at InclusiveRangev2.d(79):
Boolean type cannot be used!
----------------
??:? _d_assert_msg [0x55e17c3c881e]
??:? pure nothrow @safe void
source.inclusiveRange!(bool).inclusiveRange(bool...)
[0x55e17c3c575f]
??:? _Dmain [0x55e17c3a8e43]
Process finished with exit code 1.
*/
```
Tuesday, 10 May 2022 at 14:44:06 UTC, frame wrote:
> On Tuesday, 10 May 2022 at 13:14:20 UTC, Salih Dincer wrote:
>
>> must satisfy the following constraint:
>
> That is your type protection here, a constraint.
Thank you, I solved the problem by adding a second function.
D, you are great!
SDB at 79
More information about the Digitalmars-d-learn
mailing list