On Sat, 11 Oct 2014 08:41:15 +0000
Nicolas Sicard via Digitalmars-d <[email protected]> wrote:

> On Friday, 10 October 2014 at 22:34:45 UTC, ketmar via
> Digitalmars-d wrote:
> >> I think I like the idea of the factory method now though, as 
> >> I've learned you can hide a struct inside a function, and then 
> >> call the function to set the struct up properly and return it. 
> >> At least, I'm sure I've seen code that does that..
> > ah, yes, it's "Voldemort type". ;-)
> >
> >   auto thatWhoCantBeNamed () {
> >     static struct A { ... }
> >     return A();
> >   }
> >
> > voila. you have type that you can use but cannot create without
> > factory. but you need to have postblit enabled with this.
> 
> It's not a "Voldemort type" if the struct A is static, is it? You
> can just alias A = typeof(thatWhoCantBeNamed()); and then create
> a new object of the same type.
yes, my bad. i'm so used to write "static" to avoid the things that
compiler can remove for me that my code is polluted with it.

thank you.

Attachment: signature.asc
Description: PGP signature

Reply via email to