Anton Daneyko wrote:
Could you add some more details to your question. It's not clear at least
for me.
Sorry that wasn't clear: I want functions of 2d array args, whose sizes are
arguments too.
In the following I presumably need to
1) use index_gen to tell multi_array that A has extents Am x An
2) cast normal C arrays to multi_array args
Thanks
#include
using namespace boost;
typedef multi_array< float, 2 > Array;
typedef multi_array_ref< float, 2 > Arrayref;
typedef const_multi_array_ref< float, 2 > Arrayconstref;
typedef multi_array_types::size_type siz;
// 2d array args with runtime sizes: A[Am][An] -> a[am][an] ?
void arrayargs( Arrayconstref A, Arrayref a, siz Am, siz An, siz am, siz an
)
{
// how say that A is Am x An ?
int j = 0, k = 1;
a[j][k] = A[j][k] / 4; // ...
}
int main( int argc, char* argv[] )
{
int am = 100, an = 200;
float A[am*2][an*2], a[am][an]; // vla
arrayargs( A, a, am*2, an*2, am, an ); // how cast A, a ?
}
--
View this message in context: http://www.nabble.com/2d-array-arg%2C-f%28-int-m%2C-int-n%2C-int-a-m--n--%29...
Sent from the Boost - Users mailing list archive at Nabble.com.