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 | b9bf45fea55a56203f16a1eea4de7f46d8bbf964 (patch) | |
tree | 09cbc057fdb43e61ba703617e19c8b3b341670fb /src/Partitioning.h | |
parent | 8634c0958c532e7d219e649353e1f1a74d52da1b (diff) | |
download | scintilla-mirror-b9bf45fea55a56203f16a1eea4de7f46d8bbf964.tar.gz |
Use noexcept in basic data structures where reasonable.
Declare the standard member functions in more classes
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 9237df0fa..c6951388e 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; |