Prevent default-initialised struct
Denis Koroskin
2korden at gmail.com
Mon Jan 26 15:26:32 PST 2009
On Mon, 26 Jan 2009 20:40:01 +0300, BCS <none at anon.com> wrote:
> Hello Daniel,
>
>> Hi all,
>> is there any way to prevent a struct from being created directly?
>> Basically, I want to prevent this:
>> {
>> non_null!(T) a;
>> }
>> I want people to have to use provided functions to create a structure:
>> {
>> auto a = non_null!(T)(new T);
>> }
>> -- Daniel
>>
>
> struct S { private static S opCall(); } //???
>
>
Nope:
S s; //okay
More information about the Digitalmars-d-learn
mailing list