Type Parameter Deduction
Salih Dincer
salihdb at hotmail.com
Tue May 10 13:14:20 UTC 2022
On Tuesday, 10 May 2022 at 12:56:50 UTC, frame wrote:
> On Tuesday, 10 May 2022 at 09:26:46 UTC, Salih Dincer wrote:
>
>> However, the compiler catches other errors! How can I solve
>> this problem?
>>
>> Thanks...
>>
>> SDB at 79
>
> What about something like this?
>
> ```d
> auto inclusiveRange(T = int)(T f = T(0), T l = T(0), T s = T(1))
> if(!is(T == bool))
> {
> //...
> }
> ```
Not compiled, the compiler returns:
> InclusiveRange.d(48): Error: template instance
> `InclusiveRange.ir!bool` does not match > template declaration
> `inclusiveRange(T = int)(T f = T(0), T l = T(0), T s = T(1))`
> with `T = bool`
> must satisfy the following constraint:
> ` !is(T == bool)`
SDB at 79
More information about the Digitalmars-d-learn
mailing list