GSoC-2011 project:: Containers

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 4 05:12:53 PDT 2011


On Fri, 01 Apr 2011 22:56:07 -0400, Ishan Thilina <ishanthilina at gmail.com>  
wrote:

>> The file you attached does not work, gzip says the file end prematurely.
>
> I tried to upload that file three times. In the first two times plainly  
> as the
> container.d file, and it didn't work( the mail isn't shown on the  
> mailing list).
> Next I tried to upload the tar.gz file and it worked( also that tar file  
> works in
> my pc very well :s). I'll give a link from a file sharing site.
>
> http://www.filejumbo.com/Download/B83F562EEAEAA694
>
>> FYI, I did not implement Queue (or Stack) because it is a simple adapter
>> on List.  I made an executive decision to avoid adapter classes because  
>> I
>> feel they add little value.  This does not mean you shouldn't implement
>> it, but I think it belongs more in the higher level types (like map,  
>> set,
>> etc) and have it use an implementation container as it's base.  Andrei?
>
> Yes, It's better if an implementation container can be used as a base to  
> the
> containers that we going to develop. The existing data structures such  
> as the
> SList and Array will be highly useful because more concrete data  
> structures can be
> built up on them.

There are several problems with your code.

I'd recommend not putting your code in std.container at first.  It will be  
easier to deal with, because people will know which code you wrote and  
also it will be better when posting code for questions.

I see two problems right off the bat:

1. your Range!T has two definitions for @property void front(T value)
2. Range!T uses Node, which has no definition.

I'm guessing you meant Range!T to be a part of Queue?  I'm not sure what  
you are doing exactly, because there are no usages of Queue in your code  
(i.e. it compiles because none of your templates are instantiated).  If  
you want Range to be part of Queue, put it inside the definition of  
Queue.  It will make things easier, and not pollute the namespace.   
Range!T is not a good name to put in the global namespace.

-Steve


More information about the Digitalmars-d mailing list