Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVecInt Reverse | Reverse vector elements. |
| └ indexed: TMtxVecInt Reverse(Int32 Index, Int32 Len) | ||
| 2 | TVecInt Reverse(TMtxVecInt Vec) | Reverse all Vec elements. |
| └ indexed: TMtxVecInt Reverse(TMtxVecInt Vec, Int32 VecIndex, Int32 Index, Int32 Len) |
Overload 1: TVecInt Reverse
Reverse vector elements.
Result: stored in self (calling object), returns self for chaining
The method reverses vector elements by using the following equation:
This overload reverses all calling vector elements in-place.
TVecInt a;
MtxVec.CreateIt(out a);
try
{
a.SetIt(new double[] {1,2,3,4});
a.Reverse; // a = new double[] {4,3,2,1}
}
finally
{
MtxVec.FreeIt(ref a);
}
Indexed: 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
An exception is raised if array borders are overrun.
Overload 2: TVecInt Reverse(TMtxVecInt Vec)
Reverse all Vec elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVecInt | source TVecInt or TMtxInt |
Result: stored in self (calling object), returns self for chaining
Xtore the result in the calling vector elements. The Dew.Math.TMtxVecBase.Length property of the calling vector are set implicitly to match Vec vector.
Indexed: 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
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.
using Dew.Math;
using Dew.Math.Units;
namespace Dew.Examples
{
void Example()
{
TVecInt a;
MtxVecInt.CreateIt(out a);
try
{
a.SetIt(new int[] {1,2,3,4});
a.Reverse(); // a = [4,3,2,1]
}
finally
{
MtxVecInt.FreeIt(ref a);
}
}
}