Re: Dynamic multi-dimensional arrays.
From: Steven T. Hatton (susudata_at_setidava.kushan.aa)
Date: 06/04/04
- Next message: Thomas Matthews: "Re: class TChart i n C++Builde 6"
- Previous message: Moritz Beller: "Re: Random Numbers -- why doesn't this piece of code work?"
- In reply to: Havatcha: "Re: Dynamic multi-dimensional arrays."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 04 Jun 2004 10:17:15 -0400
Havatcha wrote:
>> Wow. I don't even know what three stars in a row mean. C++ lets you
>> define fixed multi-dimensional arrays, so I'd assumed it would let you
>> define them dynamically with something similar to the usual notation.
>>
>
>
> Yeah, that would be lovely. You should consider using the Standard
> Template Library stuff
> (http://www.msoe.edu/eecs/cese/resources/stl/index.htm#WhatIs) for this
> kind of thing.
It depends what your objectives are. Things such as vector, of vector of
vector, are easier to implement than multidimensional mappings over
valarray. OTOH, valarray is designed to support maximum efficiency and
will most likely run faster than any of the other alternatives from the
Standard Library. Various people have proposed a real array template for
the standard. That is, a 'vector' of fixed size.
Check out the last three examples from this page:
http://www.research.att.com/~bs/3rd_code.html
Somewhere on Josuttis's site there is an example of an implementation of a
multidimensional array.
http://www.josuttis.com/libbook/index.html
> A raw array of pointers like the implementation described is very fast,
> but can make life difficult.
There are a lot of different matrix and multidimensional array
implementations such as are found at www.boost.org, Blitz++, MTL, etc.
>> I knew what vectors and some of that other stuff were, at one time. I'll
>> have to find out again. It's a lot of stuff to keep in one head.
I had taken a course in C++ just before templates came into the mainstream.
When I picked up C++ again this year, I thought it was going to be
relatively easy to get up to speed. I have never worked so hard at
learning anything in all my life, and I've read the
_Feynman_Lectures_on_Physics_ and worked the problems in the exercise
manual.
I should add that part of the reason it's been tough going is because I am
learning by using the latest gcc and the CVS images of KDevelop. It's not
called 'bleeding edge' for naught.
-- STH Hatton's Law: "There is only One inviolable Law" KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com Mozilla: http://www.mozilla.org
- Next message: Thomas Matthews: "Re: class TChart i n C++Builde 6"
- Previous message: Moritz Beller: "Re: Random Numbers -- why doesn't this piece of code work?"
- In reply to: Havatcha: "Re: Dynamic multi-dimensional arrays."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|