On Thu, 21 Jun 2012 08:53:33 -0400, d coder <dlang.co...@gmail.com> wrote:

Greetings

I do not know if this email belongs to this list or not. It is about a
package available at dsource. Let me know if I should be posting such
emails elsewhere.

This list is fine, you can also create tickets for the TRAC instance for dcollections.

http://www.dsource.org/projects/dcollections/newticket


I need an implementation of Doubly Linked list and Deque. Since the
std.container library does not support these containers yet, I am trying to
use these from DCollections library available on DSource here
http://www.dsource.org/projects/dcollections . I am using the D2 branch of
this library.

Now the issue is, I could not find any API for adding elements to the
beginning of the LinkList. In the documentation (which is there for D1
version) I see methods like append and prepend, but I do not think these
are implemented in the D2 version of the library. And I see that for Deque,
only prepend is implemented, there is no append.

prepend should be implemented for LinkedList, that is an oversight. Yes, you can use insert(ll.begin, elem), but the API should be consistent across containers.


Also it is not clear to me if the "add" method could be used to append
elements on the back of the LinkList or Deque collection.

Append is actually implemented via add. For lists, add always adds to the end (including ArrayList, LinkList and Deque). This is not a requirement of the interface, but it happens to be how it's implemented for all the current containers. This should be noted in the docs (which I profusely apologize for not having available).

I should make an alias to append from add.

-Steve

Reply via email to