Connecting Tech Pros Worldwide Forums | Help | Site Map

boost multi array dynamic size

marcomoeller@googlemail.com
Guest
 
Posts: n/a
#1: Sep 7 '07
Hi,

I whant to write an function (ore overloading the class) which is able
to trace out an row of the Array. So the function becomes an array of
Dim n and returns one of Dim n-1.

something like:
template <class T, class B>
boost::multi_array<T, B - 1* TraceOut(boost::multi_array<T, Ba,
int i){
//Summerize the values of a into a new array without to consider
different values in the i-th Row
}

I know that B-1 is not possible.. do you have any better idea?

THX


Marco


Ivan Vecerina
Guest
 
Posts: n/a
#2: Sep 7 '07

re: boost multi array dynamic size


<marcomoeller@googlemail.comwrote in message
news:1189180606.623196.183920@57g2000hsv.googlegro ups.com...
: I whant to write an function (ore overloading the class) which is able
: to trace out an row of the Array. So the function becomes an array of
: Dim n and returns one of Dim n-1.
:
: something like:
: template <class T, class B>
: boost::multi_array<T, B - 1* TraceOut(boost::multi_array<T, Ba,
: int i){
: //Summerize the values of a into a new array without to consider
: different values in the i-th Row
: }
:
: I know that B-1 is not possible.. do you have any better idea?

The expression (B-1) is perfectly ok, if you correctly declare
B as an ordinal template parameter (not as a type).

Something like the following should work:
template< class T, std::size_t N >
boost::multi_array<T,N-1>
TraceOut( boost::multi_array<T,Nconst& a, int i )
{ ... }

hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <http://www.brainbench.com

Closed Thread