isCopyable and isAssignable

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 9 01:33:08 PDT 2016


On Sunday, October 09, 2016 07:27:38 James Buren via Digitalmars-d-learn 
wrote:
> On Sunday, 9 October 2016 at 07:23:05 UTC, Nordlöw wrote:
> > Now that we have isCopyable from
> >
> > https://github.com/dlang/phobos/pull/4706
> >
> > can somebody briefly outline when something fulfills
> > `isCopyable` but not `isAssignable` and vice versa?
>
> I would imagine that an intermediate value, or other lvalue, may
> be copyable, but not assignable.

Yes, but isCopyable is checking a type, not a value, so that doesn't enter
into it. To check any kind of value with isCopyable, you'd have to use
typeof on it.

- Jonathan M Davis




More information about the Digitalmars-d-learn mailing list