Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8532

Crash when declaring 2D dynamic arrays

$
0
0

@pagarcia wrote:

Hi,

In this example I'm defining an array test as { {0,1}, {0,1,2} }

ON_SimpleArray<ON_SimpleArray<int>> test;
test.Reserve(2);
test.SetCount(2);

test[0].Reserve(2);
test[0].SetCount(2);
test[0][0] = 0;
test[0][1] = 1;

test[1].Reserve(3);
test[1].SetCount(3);
test[1][0] = 0;
test[1][1] = 1;
test[1][2] = 2;

When executing this, the arrays test[0] and test[1] seem to have always Count at 0. The lines of Reserve give the crash. Apparently the sizes cannot be increased from 0.

What's the proper way to define this? In case this construct turns out to be inefficient, is there a better way to create arrays with arrays as components?

Thanks a lot,
Pablo

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 8532

Trending Articles