473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

boost multi array dynamic size

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

Sep 7 '07 #1
1 3090
<ma**********@googlemail.comwrote in message
news:11**********************@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

Sep 7 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Cant Think Today | last post by:
I have multi-dimesional arrays that can be specifed by the user, e.g 1,2,3,4,5 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6 I think a bit of code that will iterate over these arrays to print out the...
8
by: masood.iqbal | last post by:
All this time I was under the illusion that I understand the concept of multi-dimensional arrays well ---- however the following code snippet belies my understanding. I had assumed all along...
4
by: jayharris | last post by:
I'm having a ton of trouble initializing a multi-dimensional array inside a constructor, largely because I don't know the size of the array until runtime. I have a class that looks like this: ...
7
by: nw | last post by:
Hi, We've been having a discussion at work and I'm wondering if anyone here would care to offer an opinion or alternative solution. Aparently in the C programming HPC community it is common to...
3
by: =?iso-8859-1?B?Tm9yZGz2dw==?= | last post by:
Hey there, C++ Coders! I am learning multi-threading with boost and have come up with the following code example shown below. This example implements a test of the producer-consumer design...
0
by: Ling | last post by:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
by: Joey Mukherjee | last post by:
Hello! I am trying to use boost::multi_array and want to create a view where I am lowering the number of dimensions, but I wish the dimension to be reduced to be decided at runtime. I have a...
0
by: varnie | last post by:
hell-o !~ i faced weird problem during usage boost::pool_allocator. after i've changed: typedef boost::shared_ptr< param > ParamPtr; typedef std::vector< ParamPtr > ParamPtrVector; with:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.