Strange casting error when using lamdas
Steven Schveighoffer
schveiguy at gmail.com
Thu Dec 5 15:47:25 UTC 2019
On 12/5/19 3:57 AM, Robert M. Münch wrote:
> On 2019-12-04 19:23:07 +0000, Steven Schveighoffer said:
>
>> Is one a delegate and one a function pointer? This can easily happen
>> for untyped lambdas.
>
> That's a very good point and hint. A function pointer will be 8LU and a
> delegate 16LU, right? This is a strong argument that this is really the
> problem.
>
> How can I find out? That's why I used a pragma to get the type of the
> alias. So, the alias needs to become a delegate. No clue how to write
> this down.
>
>
Use std.functional.toDelegate. If it's already a delegate, it just
returns the delegate, otherwise it makes a delegate out of a function
pointer.
-Steve
More information about the Digitalmars-d-learn
mailing list