On Saturday, 15 June 2019 at 17:42:04 UTC, ag0aep6g wrote:
On Saturday, 15 June 2019 at 17:24:45 UTC, user1234 wrote:
---
void foo(){writeln(__PRETTY_FUNCTION__);}
void main(string[] args)
{
void delegate() dg;
dg.funcptr =
dg.ptr = null; // usually a "this" or a frame address
On Saturday, 15 June 2019 at 17:24:45 UTC, user1234 wrote:
---
void foo(){writeln(__PRETTY_FUNCTION__);}
void main(string[] args)
{
void delegate() dg;
dg.funcptr =
dg.ptr = null; // usually a "this" or a frame address
dg();
}
---
because dg.ptr would be used to retrieve the
On Saturday, 15 June 2019 at 16:34:22 UTC, Robert M. Münch wrote:
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be
mixed. But the standard function std.functional.toDelegate
converts a function to a delegate."
Your example compiles
On Saturday, 15 June 2019 at 16:34:22 UTC, Robert M. Münch wrote:
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be
mixed. But the standard function std.functional.toDelegate
converts a function to a delegate."
Your example compiles
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be mixed. But
the standard function std.functional.toDelegate converts a function to
a delegate."
Your example compiles if the assignment is changed to dg =
toDelegate(); (given
On Saturday, 15 June 2019 at 15:54:00 UTC, Robert M. Münch wrote:
Why does the follwing code give: Error: cannot implicitly
convert expression & myFunc of type void function(int a) to
void delegate(int)
void myFunc(int a){return;}
void main()
{
void delegate(int) dg;
dg =
}
See: