[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: C++ Template Question
From:       Mosfet <daniel.duley () verizon ! net>
Date:       2007-08-20 22:12:18
Message-ID: 200708201712.18456.daniel.duley () verizon ! net
[Download RAW message or body]

<Hans wrote>
> The only question I have about it is if it is possible to use this to
> create a multidimensional array and if so what is the proper way?

You mean sth. like this?

typedef QVarLengthArray<int, 50> Row;
QVarLengthArray<Row, 50> image(height);
for(uint y=0; y<height; ++y)
  image[y].resize(width);

</Hans>

I was thinking more about if you can create a multidimensional array using 
just one QVarLengthArray in a nice way. I think with the above code you might 
as well just use a QList of QVarLengthArrays, which is not what I want.
Not a big problem - I can convert to offsets - just curious since I am no 
template guru.

<Hans also wrote>
..or you could use a "view"-like 2D adapter with a 1D QVarLengthArray.
(Our VIGRA library has such a thing:
http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/doc/vigra/classvigra_1_1BasicImageView.html)
</Hans>

Bookmarked and I will look at this more. Template image algorithm 
implementations seem to be getting quite popular.

On a side note, I first interpreted this project's name as "Viagra", which at 
least in the US has a totally different meaning but would also be good for a 
fast imaging library >:)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic