Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVecInt Reverse(TMtxVecInt Vec, Int32 VecIndex, Int32 Index, Int32 Len) | Reverse vector elements. |
| 2 | TMtxVecInt Reverse(Int32 Index, Int32 Len) | Reverses the calling object elements [Index]..[Index+Len-1]. |
Overload 1: TMtxVecInt Reverse(TMtxVecInt Vec, Int32 VecIndex, Int32 Index, Int32 Len)
Reverse vector elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVecInt | source TVecInt or TMtxInt |
| 2 | VecIndex | Int32 | |
| 3 | Index | Int32 | start index |
| 4 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Remarks:
The method reverses Vec vector elements from [VecIndex].. [VecIndex+Len-1] and stores them in the calling vector from [Index]...[Index+Len-1] by using the following equation:
This overload reverses calling vector elements in-place.
Examples
using Dew.Math;
using Dew.Math.Units;
namespace Dew.Examples
{
void Example()
{
TMtxInt a;
MtxVecInt.CreateIt(out a);
try
{
a.SetIt(2,2, new int[] {1,2,3,4});
a.Reverse(); // a = [2,1,3,4]
}
finally
{
MtxVecInt.FreeIt(ref a);
}
}
}
Overload 2: TMtxVecInt Reverse(Int32 Index, Int32 Len)
Reverses the calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | Int32 | start index |
| 2 | Len | Int32 | element count |
Result: stored in self (calling object), returns self for chaining
Remarks:
An exception is raised if array borders are overrun.