0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

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
This commit is contained in:
Jon Atack 2022-04-28 20:20:30 +02:00
parent 8730bd3fc8
commit abc1ee5090
2 changed files with 4 additions and 2 deletions

View file

@ -458,7 +458,8 @@ public:
return *item_ptr(size() - 1);
}
void swap(prevector<N, T, Size, Diff>& other) {
void swap(prevector<N, T, Size, Diff>& other) noexcept
{
std::swap(_union, other._union);
std::swap(_size, other._size);
}

View file

@ -328,7 +328,8 @@ public:
bool operator()();
void swap(CScriptCheck &check) {
void swap(CScriptCheck& check) noexcept
{
std::swap(ptxTo, check.ptxTo);
std::swap(m_tx_out, check.m_tx_out);
std::swap(nIn, check.nIn);