Skip to content

Commit abc1ee5

Browse files
committed
validation: make CScriptCheck and prevector swap member functions noexcept
Reason: A swap must not fail; when a class has a swap member function, it should be declared noexcept. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c84-a-swap-function-must-not-fail
1 parent 8730bd3 commit abc1ee5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/prevector.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ class prevector {
458458
return *item_ptr(size() - 1);
459459
}
460460

461-
void swap(prevector<N, T, Size, Diff>& other) {
461+
void swap(prevector<N, T, Size, Diff>& other) noexcept
462+
{
462463
std::swap(_union, other._union);
463464
std::swap(_size, other._size);
464465
}

src/validation.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ class CScriptCheck
328328

329329
bool operator()();
330330

331-
void swap(CScriptCheck &check) {
331+
void swap(CScriptCheck& check) noexcept
332+
{
332333
std::swap(ptxTo, check.ptxTo);
333334
std::swap(m_tx_out, check.m_tx_out);
334335
std::swap(nIn, check.nIn);

0 commit comments

Comments
 (0)