digitalmars.D.learn - isCopyable and isAssignable
- =?UTF-8?B?Tm9yZGzDtnc=?= (4/4) Oct 09 2016 Now that we have isCopyable from
- James Buren (3/7) Oct 09 2016 I would imagine that an intermediate value, or other lvalue, may
- Jonathan M Davis via Digitalmars-d-learn (6/15) Oct 09 2016 Yes, but isCopyable is checking a type, not a value, so that doesn't ent...
- Jonathan M Davis via Digitalmars-d-learn (9/13) Oct 09 2016 If it's const or immutable, it could be copyable but not assignable. Als...
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?
Oct 09 2016
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.
Oct 09 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: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 DavisNow 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.
Oct 09 2016
On Sunday, October 09, 2016 07:23:05 Nordlöw via Digitalmars-d-learn 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?If it's const or immutable, it could be copyable but not assignable. Also, someone could specifically disable opAssign while still allowing copying, though I don't know why anyone would want to do that. As for the reverse, disabling the postblit constructor would disable copying, and if opAssign takes its argument by ref, then assignment should still work (though I'm not sure whether it would still work if you didn't explicitly overload opAssign). - Jonathan M Davis
Oct 09 2016