Incomplete types question

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 8 04:36:56 PDT 2014


Marc Schütz:

> Instead, you can use a public alias to a private type:
>
> // my_module.d:
>
> private struct MyStructImpl {
>     int x;
> }
>
> public alias MyStructPtr = MyStructImpl*;
>
> void doSomething(MyStructPtr foo) {
>     ...
> }
>
> // my_main_program.d:
>
> MyStructPtr bar;    // OK
> MyStructImpl foo;   // Error: my_module.MyStructImpl is private

I still don't understand the point of doing this. Is @disable 
this usable here?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list