diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-21 11:22:39 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-21 11:22:39 +1000 |
commit | 4f2f1c4d742d391eb541238317ede70959b6f58d (patch) | |
tree | 163773e58bd17a04e5e5c487363ef9bdd711f737 /src/Partitioning.h | |
parent | 2a1338ce2d7c813db6f650154e2e3b6fdde06ff5 (diff) | |
download | scintilla-mirror-4f2f1c4d742d391eb541238317ede70959b6f58d.tar.gz |
Backport: Use noexcept in basic data structures where reasonable.
Declare the standard member functions in more classes
Backport of changeset 6725:2864bc1b748a.
Diffstat (limited to 'src/Partitioning.h')
-rw-r--r-- | src/Partitioning.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Partitioning.h b/src/Partitioning.h index 89faf8b8e..a92e55b53 100644 --- a/src/Partitioning.h +++ b/src/Partitioning.h @@ -23,10 +23,12 @@ public: } // Deleted so SplitVectorWithRangeAdd objects can not be copied. SplitVectorWithRangeAdd(const SplitVectorWithRangeAdd &) = delete; + SplitVectorWithRangeAdd(SplitVectorWithRangeAdd &&) = delete; void operator=(const SplitVectorWithRangeAdd &) = delete; + void operator=(SplitVectorWithRangeAdd &&) = delete; ~SplitVectorWithRangeAdd() { } - void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, T delta) { + void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, T delta) noexcept { // end is 1 past end, so end-start is number of elements to change ptrdiff_t i = 0; const ptrdiff_t rangeLength = end - start; @@ -63,7 +65,7 @@ private: std::unique_ptr<SplitVectorWithRangeAdd<T>> body; // Move step forward - void ApplyStep(T partitionUpTo) { + void ApplyStep(T partitionUpTo) noexcept { if (stepLength != 0) { body->RangeAddDelta(stepPartition+1, partitionUpTo + 1, stepLength); } @@ -75,7 +77,7 @@ private: } // Move step backward - void BackStep(T partitionDownTo) { + void BackStep(T partitionDownTo) noexcept { if (stepLength != 0) { body->RangeAddDelta(partitionDownTo+1, stepPartition+1, -stepLength); } @@ -91,13 +93,15 @@ private: } public: - explicit Partitioning(int growSize) { + explicit Partitioning(int growSize) : stepPartition(0), stepLength(0) { Allocate(growSize); } // Deleted so Partitioning objects can not be copied. Partitioning(const Partitioning &) = delete; + Partitioning(Partitioning &&) = delete; void operator=(const Partitioning &) = delete; + void operator=(Partitioning &&) = delete; ~Partitioning() { } @@ -114,7 +118,7 @@ public: stepPartition++; } - void SetPartitionStartPosition(T partition, T pos) { + void SetPartitionStartPosition(T partition, T pos) noexcept { ApplyStep(partition+1); if ((partition < 0) || (partition > body->Length())) { return; |