@disable this for structs

Mike Parker aldacron at gmail.com
Thu Feb 27 17:16:40 PST 2014


On 2/28/2014 3:10 AM, Steve Teale wrote:
> Could someone please explain what you would use this for to an old man
> rooted in C++, but who loves D.
>
> Where does it fit in relative to 42?
>
> ;=(
>
> Steve

I use it for namespaces.

struct Foo {
    @disable this();
    @disable this( this );

    private static {
       // members
    }

    public static {
       // methods
    }
}

Ideally, I'd love for the compiler to pick up on this idiom and not 
generate any typeinfo in this situation.


More information about the Digitalmars-d-learn mailing list