Struct default constructor - need some kind of solution for C++ interop

Jerry via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 7 18:43:18 PDT 2016


Just as a random jumpin.
Couldn't this be worked around with something like this:

struct Foo {
   @disable this();
   private this(int x) { /* init */ }
}

auto foo() {
   return Foo(0);
}

You basicly just hides the weird int x constructor and still 
disallows default construction. I guess would not be desirable 
with mutexes being locked and unlocked but for most else it 
should be good enough I guess.


More information about the Digitalmars-d mailing list