LinkedList and Deque API in DCollections

Christophe Travert travert at phare.normalesup.org
Thu Jun 21 08:15:38 PDT 2012


d coder , dans le message (digitalmars.D:170396), a écrit :
> --e0cb4efe2a2821373604c2fc4a15
> Content-Type: text/plain; charset=ISO-8859-1
> 
>>
>>
>> Did you try : list.insert(list.begin, value);
>>
> 
> Thanks. But I believe append and prepend are too common use-cases to be
> ignored.
> 
> Also, I see that "assert(some-expression)" has been used at a lot of places
> in the code of the libraries. Since these libraries are built with -release
> option, should these assert statements not be replaced by "enforce"?
> 

auto append(T, V)(ref T t, V value)
{
  return t.insert(t.begin, value);
}

should do the trick.
(you may add a guard to make sure T is a container)


More information about the Digitalmars-d mailing list