applay for template function with sumtypes result?
Steven Schveighoffer
schveiguy at gmail.com
Tue Jul 4 14:42:31 UTC 2023
On 7/4/23 10:19 AM, kiriakov wrote:
> On Tuesday, 4 July 2023 at 12:43:19 UTC, Steven Schveighoffer wrote:
>> On 7/4/23 12:58 AM, kiriakov wrote:
>
>> It looks like a type mismatch. The function accepted should return
>> `Result` but it's returning `ParsResult`.
>>
> That's the problem
>
> Result(T) = SumType!(ParsResult!T, Err!T)
>
No, `Result(T)` is its own struct in your example.
And also, `SumType!(ParsResult!T, Err!T)` is not the same as
`ParsResult!T`. function pointers must match the return type.
-Steve
More information about the Digitalmars-d-learn
mailing list