www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Array class

reply David Medlock <amedlock nospam.org> writes:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Here is an lightweight array(or vector) class which I have been using 
(and improving) for anyone who wishes to use it (or until Matthew gets 
DTL/rangelib going again).

alias Array!(char) works pretty well as a String class, too.

Its in the public domain.

PS. I didnt call it Vector, because of the 3d stuff I was using it for.
Feb 21 2005
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"David Medlock" <amedlock nospam.org> wrote in message 
news:cvd8t5$ei5$1 digitaldaemon.com...
 Here is an lightweight array(or vector) class which I have been using
 (and improving) for anyone who wishes to use it (or until Matthew gets
 DTL/rangelib going again).

<with red cheeks, and a pensive sigh>Sometime next month - it'll be made flesh concurrently with DPD.</>
Feb 21 2005
parent reply David Medlock <ashleymedlock no.spam.yahoo.com> writes:
Matthew wrote:

 "David Medlock" <amedlock nospam.org> wrote in message 
 news:cvd8t5$ei5$1 digitaldaemon.com...
 
Here is an lightweight array(or vector) class which I have been using
(and improving) for anyone who wishes to use it (or until Matthew gets
DTL/rangelib going again).

<with red cheeks, and a pensive sigh>Sometime next month - it'll be made flesh concurrently with DPD.</>

guy. Congrats on your book. The C++ people need all the help they can get :) Your rangelib stuff looks very good. I was tempted to take a stab at something similar in concept, but I expect you have a (better)codebase already cooking. That said if you want my help, email me.
Feb 21 2005
parent "Matthew" <admin.hat stlsoft.dot.org> writes:
"David Medlock" <ashleymedlock no.spam.yahoo.com> wrote in message
news:cvdq1r$12fd$1 digitaldaemon.com...
 Matthew wrote:

 "David Medlock" <amedlock nospam.org> wrote in message
news:cvd8t5$ei5$1 digitaldaemon.com...

Here is an lightweight array(or vector) class which I have been using
(and improving) for anyone who wishes to use it (or until Matthew gets
DTL/rangelib going again).

<with red cheeks, and a pensive sigh>Sometime next month - it'll be made flesh concurrently with DPD.</>

all the help they can get :)

He he
 Your rangelib stuff looks very good.  I was tempted to take a stab at
something similar in concept, but I expect you 
 have a (better)codebase already cooking.

I've just spent some effort in tidying it up, to be released with STLSoft 1.8.3b1 tomorrow.
 That said if you want my help, email me.

Take a look at the new release, and let me know. Help/requests/opinions always welcome. :-)
Feb 28 2005
prev sibling parent David Medlock <amedlock nospam.com> writes:
David Medlock wrote:
 Here is an lightweight array(or vector) class which I have been using 
 (and improving) for anyone who wishes to use it (or until Matthew gets 
 DTL/rangelib going again).
 
 alias Array!(char) works pretty well as a String class, too.
 
 Its in the public domain.
 
 PS. I didnt call it Vector, because of the 3d stuff I was using it for.
 
 

Something odd I just realized: (actually not too odd once I thought about it). The comparison operator opEquals only works when the two arrays have the same InitialSize parameter. The reason I put it in the template and not the constructor is that I wished to have a single value constructor also. Its easily worked around using the empty slice operator, but its still annoying. I don't know if templates could be smart enough to realize the types being compared were similar enough. -David -- example import array; void main( char[][] arg ) { alias Array!(int,16) IntArray16; alias Array!(int,200) IntArray200; IntArray16 a = new IntArray16(); IntArray200 b = new IntArray200(); static int[] tmp = [ 100, 200, 300 ]; a << tmp; b << tmp; assert( a==b ); // compile error assert( a==b[] ); // this is ok }
Feb 21 2005