How I can create array of array and than use it like MyArray[j].
Now I used:
irr::core::array<s32> node;
and than node = ....
irr::core::array<irr::core::array<s32>> node; - it's wrong;
Or I should use:
irr::core::array<s32 *> node???
array of array in irrlicht
-
- Posts: 377
- Joined: Fri Oct 28, 2005 10:28 am
- Contact:
i'd like to use this thread for another question on arrays:
is it possible to initialize an array with values from start?
i.e. core::array<int> array = [1,2,3,4] ?
until know i would rather use
core::array<int> array;
for (int i=0; i<4; i++) array.push_back(i+1);
but this doesn't help me when i have unordered items such as [4,2,1,3]
is it possible to initialize an array with values from start?
i.e. core::array<int> array = [1,2,3,4] ?
until know i would rather use
core::array<int> array;
for (int i=0; i<4; i++) array.push_back(i+1);
but this doesn't help me when i have unordered items such as [4,2,1,3]
Code: Select all
s32 arr[] = { 4, 2, 1, 3 };
Of course you could always do this...
Code: Select all
#define countof(x) (sizeof(x) / sizeof(*x))
s32 arr[] = { 4, 2, 1, 3 };
core::array<s32> vals;
for (u32 i = 0; i < countof(arr); ++i)
vals.push_back(arr[i]);
// if you used the c++stdlib
std::vector<s32> vec;
std::copy(arr, arr + countof(arr), std::back_inserter(vec));