Challenge: write a reference counted slice that works as much as possible like a built-in slice
Adam Ruppe
destructionator at gmail.com
Mon Nov 8 22:49:33 UTC 2021
On Monday, 8 November 2021 at 22:35:59 UTC, Andrei Alexandrescu
wrote:
> How do you mean "now"?
errr I meant "not". since it is const, you aren't allowed to
modify it or *anything* through it. that would include the ref
count.
(now i know you can look it up in a global AA, using the pointer
as a key into it, and fake it, so this prohibition isn't really
that meaningful. but of course pure prohibits even that, so
there's no winning - if modifying that refcont, either you're
const and not pure, or you're pure and not const. perhaps the
definition of const should change though.)
More information about the Digitalmars-d
mailing list