Thread overview
Array class
Feb 21, 2005
David Medlock
Feb 21, 2005
Matthew
Feb 21, 2005
David Medlock
Feb 28, 2005
Matthew
Feb 22, 2005
David Medlock
February 21, 2005
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.



February 21, 2005
"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.</>



February 21, 2005
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.</>
> 
> 
> 
Didnt mean that as a 'wheres DTL' innuendo; it appears you're a busy 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.
February 22, 2005
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.
> 
> 
<snip>

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
}
February 28, 2005
"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.</>
>>
>>
>>
> Didnt mean that as a 'wheres DTL' innuendo; it appears you're a busy guy.  Congrats on your book.  The C++ people need 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. :-)