Why I can't pass to datetime.benchmark function with parameters?

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 23 08:11:13 PDT 2016


Working:
void main()
{
  auto r = benchmark!(foo)(1);
}

void foo()
{

}


Do not working:
void main()
{
  auto r = benchmark!(foo())(1);
}

void foo()
{

}

>Error: expression foo() is void and has no value

Do not working:
void main()
{
  auto r = benchmark!(4)(1);
}

void foo(int i)
{
  writeln(i);
}


Why I second two variants do not compile?





More information about the Digitalmars-d-learn mailing list