What is the case against a struct post-blit default constructor?
Jonathan M Davis
jmdavisProg at gmx.com
Fri Oct 12 01:33:56 PDT 2012
On Friday, October 12, 2012 10:29:06 monarch_dodra wrote:
> 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.
That just means that the problem goes further than just invariants. It's still
a big problem for invariants.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list