Persistent list

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 16 12:57:52 PST 2015


On Monday, 16 November 2015 at 18:37:18 UTC, Andrei Alexandrescu 
wrote:
> On 11/16/2015 12:51 PM, Steven Schveighoffer wrote:
>>      List tail() const
>
> I'd like tail to be qualifier-idempotent, i.e. return const for 
> const and non-const for non-const. -- Andrei

I don't have a compiler at hand right now, but doesn't this work?

auto tail(this U)() const
{
   assert(root);
   auto n = root.next;
   incRef(n);
   return U(n, allocator);
}



More information about the Digitalmars-d mailing list