Re: [Boost-users] question about multi_array use

Dear Overmind and Anton, thanks for your answers.
Let's see if I understand!
Yes, multi_array
From: OvermindDL1
To: boost-users@lists.boost.org Subject: Re: [Boost-users] question about multi_array use Message-ID: <3f49a9f40908071709rbd1ad80k4c5170093588f4d@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Fri, Aug 7, 2009 at 2:04 PM, Anton Daneyko
wrote: Hello,
I might be wrong, but it seems the answer is "no you can't do that", because the dimensionality is a template parameter multi_array
and multi_array are different types. However I would like to hear some else' opinion as well. Regards, Anton Daneyko.
On Fri, Aug 7, 2009 at 3:48 PM, Alle Meije Wink
wrote: Hello,
I would like to use the multi_array container to handle imaging data. The image data can be anything up to 8-dimensional (usually up to 4) and dimension information is found in records that accompany the binary data.
Would it be possible to create an image class that takes the dimensionality and extents list as parameters, so that images of all dimensionalities can be treated as one class?
For example, could the dimensionality be passed as a size_t argument?
What I understand from the multi_array paper is that the extents list would only be required whan the array is initialised.
You could always just wrap up each of the possible dimensions in a struct that can handle the (de)serialization and everything too, perhaps use crtp to put identical functionality in a non-virtual base class.

On Sat, Aug 8, 2009 at 4:51 PM, Alle Meije Wink
Dear Overmind and Anton, thanks for your answers.
Let's see if I understand!
Yes, multi_array
and multi_array are different types (classes?). But I wouldn't mind using a template class to wrap it if that meant I could code it once, instead of 8 times for 8 different possible dimensionalities. Would it be able to define a template class in the way I described?
Overmind, I guess compared to what I had in mind (define the data container of the image [template?] class as a multi_array with a dimensionality given as a size_t parameter), the CRTP struct you are talking about specifies all of the possible types. Is that correct?
If I understand it correctly then this does what I want, but does that mean that in the worst-case scenario, I have to write out the functionality for all different dimensionalities? If the parameterised template class idea is possible, that would save some typing!
Best wishes, Alle Meije
From: OvermindDL1
To: boost-users@lists.boost.org Subject: Re: [Boost-users] question about multi_array use Message-ID: <3f49a9f40908071709rbd1ad80k4c5170093588f4d@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Fri, Aug 7, 2009 at 2:04 PM, Anton Daneyko
wrote: Hello,
I might be wrong, but it seems the answer is "no you can't do that", because the dimensionality is a template parameter multi_array
and multi_array are different types. However I would like to hear some else' opinion as well. Regards, Anton Daneyko.
On Fri, Aug 7, 2009 at 3:48 PM, Alle Meije Wink
wrote: Hello,
I would like to use the multi_array container to handle imaging data. The image data can be anything up to 8-dimensional (usually up to 4) and dimension information is found in records that accompany the binary data.
Would it be possible to create an image class that takes the dimensionality and extents list as parameters, so that images of all dimensionalities can be treated as one class?
For example, could the dimensionality be passed as a size_t argument?
What I understand from the multi_array paper is that the extents list would only be required whan the array is initialised.
You could always just wrap up each of the possible dimensions in a struct that can handle the (de)serialization and everything too, perhaps use crtp to put identical functionality in a non-virtual base class.
I could see using fusion (mostly the "apply" construct) would make it generic to any number of dimensions. Boost.Fusion is amazing for such work, think MPL, but it works at runtime too.
participants (2)
-
Alle Meije Wink
-
OvermindDL1