On 6/19/11 7:34 PM, jdrewsen wrote:
I guess that I can initialize variables in the opCall and that way the
user should not have to remember to initialize variables?

Yes, you can just do:

---
struct Foo {
  Foo static opCall() {
    Foo result;
    result.<whatever> = <somevalue>;
    return result;
  }
  …
}
---

The thing is that the static opCall is not invoked if the user writes »Foo foo;« instead of »auto foo = Foo();«, so you need to carefully document that users need to use the opCall syntax.

David

Reply via email to