What is the case against a struct post-blit default constructor?

monarch_dodra monarchdodra at gmail.com
Fri Oct 12 01:29:06 PDT 2012


On Friday, 12 October 2012 at 08:20:42 UTC, Jonathan M Davis
wrote:
> On Friday, October 12, 2012 10:09:22 monarch_dodra wrote:
>
> If that's what you're "supposed" to do, it's only because 
> opAssign is annoying
> enough to check its invariant. Without the invariant, that's 
> not something
> that would normally make sense to do. And it's _not_ what you 
> do with a built-
> in type.
>
> int i = void;
> i = 5;
>
> is perfectly legal. I see no reason why
>
> S s = void;
> s = S(17);
>
> [SNIP]
>
> - Jonathan M Davis

The issue with initializing with void actually has nothing to do
with invariants.

Try that code defining S as RefCounted!int and see what happens.



More information about the Digitalmars-d mailing list