Curl wrapper round two

David Nadlinger see at klickverbot.at
Sun Jun 19 10:42:38 PDT 2011


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


More information about the Digitalmars-d mailing list