Relocate Data Member Function

Relocates a chunk of the array to a new index.

Prototype

int32 Relocate( int32 p_nStart, int32 p_nCount, int32 p_nNewIndex )

Parameters

Parameter Type Parameter Name Documentation
int32p_nStartThe start index of the chunk you wish to move.
int32p_nCountThe number of items to move. If you move from index 0 with count 5, then you are moving five items.
int32p_nNewIndexThe index to which you wish to move the chunk. The index cannot be inside the chunk you are relocating. For example, if you provide index 0 and a count of 5, you cannot relocate the chunk to index 0, 1, 2, 3, or 4.

Examples

Copy Text To Clipboard

import library "app_service_console_util.ssl";
import library "type_color_array_util.ssl";

auto Color r = new Color( 1, 1, 1, 255 );
auto Color g = new Color( 2, 2, 2, 255 );
auto Color b = new Color( 3, 3, 3, 255 );
auto Color a = new Color( 4, 4, 4, 255 );
auto Color x = new Color( 5, 5, 5, 255 );

auto ColorArray data;
data.Push( r );
data.Push( g );
data.Push( b );
data.Push( a );
data.Push( x );

data.Relocate( 0, 2, 3 );

LibColorArray.Out( data );

Results

COLORARRAY OUTPUT generated by TYPE_COLOR_ARRAY_UTIL.SSL
3,
3,
3,
255,
4,
4,
4,
255,
5,
5,
5,
255,
1,
1,
1,
255,
2,
2,
2,
255