ulf.schroeter Posted March 17, 2013 Share Posted March 17, 2013 problem We need to add data to UNIGINE vector array at a specific index position to keep reqired ordering. Supprisingly we realized that there is no insert( int index ) operation ( like opposit remove( int index ) ) available, only append() for adding new data to the end of the array. Though it would be possible to resort array after each insert operation this would be VERY inefficient for large arrays proposal Addition of efficient vector::insert( int index, int value ) operation Link to comment
ulf.schroeter Posted March 17, 2013 Author Share Posted March 17, 2013 BTW it might also be worse thinking about an additional allocate( int numElements ) operation for pre-allocation of larger memory chunks. This could avoid/significantly reduce re-occuring memory allocations on element inserts (comparable to ObjectBillboards::allocateBillboards() ) when upper size limit of vector is already known ahead of time (as in our case) Link to comment
frustum Posted March 17, 2013 Share Posted March 17, 2013 Two-argument version of append() function performs insert(index,value) operation. vector.allocate() will be available in the next SDK. Link to comment
ulf.schroeter Posted March 17, 2013 Author Share Posted March 17, 2013 Two-argument version of append() function performs insert(index,value) operation. Ok, didn't know that. Documentation of vector append seems to be misleading as it states that data will be appended to end. Two-argument version description only focusses on map key/value append, not on vector. Maybe this should be clarified a litte bit. vector.allocate() will be available in the next SDK. great Link to comment
manguste Posted April 3, 2013 Share Posted April 3, 2013 Ulf, I've updated it, thanks. Link to comment
Recommended Posts