diff options
author | Mike Buland <eichlan@xagasoft.com> | 2023-07-24 13:23:36 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2023-07-24 13:23:36 -0700 |
commit | b544779d5b759d4ab2b82654e3f53b82ea41bac7 (patch) | |
tree | f0e224292a679e7e660b538c3f319af80bb820f1 /src/stable | |
parent | 247ea16cad1f78f57bdb00decfba602e3455372f (diff) | |
download | libbu++-b544779d5b759d4ab2b82654e3f53b82ea41bac7.tar.gz libbu++-b544779d5b759d4ab2b82654e3f53b82ea41bac7.tar.bz2 libbu++-b544779d5b759d4ab2b82654e3f53b82ea41bac7.tar.xz libbu++-b544779d5b759d4ab2b82654e3f53b82ea41bac7.zip |
Added swap to array.
Diffstat (limited to 'src/stable')
-rw-r--r-- | src/stable/array.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stable/array.h b/src/stable/array.h index 86b57d9..885594b 100644 --- a/src/stable/array.h +++ b/src/stable/array.h | |||
@@ -103,6 +103,13 @@ namespace Bu | |||
103 | iSize--; | 103 | iSize--; |
104 | } | 104 | } |
105 | 105 | ||
106 | void swap( int iPos1, int iPos2 ) | ||
107 | { | ||
108 | value tmp = pData[iPos1]; | ||
109 | pData[iPos1] = pData[iPos2]; | ||
110 | pData[iPos2] = tmp; | ||
111 | } | ||
112 | |||
106 | valuealloc va; | 113 | valuealloc va; |
107 | value *pData; | 114 | value *pData; |
108 | long iSize; | 115 | long iSize; |
@@ -732,6 +739,12 @@ namespace Bu | |||
732 | core->swapErase( i.iPos ); | 739 | core->swapErase( i.iPos ); |
733 | } | 740 | } |
734 | 741 | ||
742 | void swap( int iPos1, int iPos2 ) | ||
743 | { | ||
744 | _hardCopy(); | ||
745 | core->swap( iPos1, iPos2 ); | ||
746 | } | ||
747 | |||
735 | protected: | 748 | protected: |
736 | virtual Core *_copyCore( Core *src ) | 749 | virtual Core *_copyCore( Core *src ) |
737 | { | 750 | { |