I tried this:

---
auto invoke(alias fun, Args...)(Args args)
{
  return fun(args);
}
---

which works with free functions:

---
int add(int a, int b)
{
  return a + b;
}

assert(invoke!add(1, 2) == 3);
---

but with a method:

---
struct Foo
{
  bool isValid(int a)
  {
    return a > 0;
  }
}

auto foo = Foo();
assert(invoke!isValid(foo, 3));
---

I get the error "undefined identifier isValid". How can I make this work?

Reply via email to