Skip to content

Commit fffc86f

Browse files
committed
test: CScriptCheck is used a lot in std::vector, make sure that's efficient
Adds a few static_asserts so CScriptCheck stays is_nothrow_move_assignable, is_nothrow_move_constructible, and is_nothrow_destructible
1 parent 81f6797 commit fffc86f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/validation.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <stdint.h>
4343
#include <string>
4444
#include <thread>
45+
#include <type_traits>
4546
#include <utility>
4647
#include <vector>
4748

@@ -331,6 +332,11 @@ class CScriptCheck
331332
ScriptError GetScriptError() const { return error; }
332333
};
333334

335+
// CScriptCheck is used a lot in std::vector, make sure that's efficient
336+
static_assert(std::is_nothrow_move_assignable_v<CScriptCheck>);
337+
static_assert(std::is_nothrow_move_constructible_v<CScriptCheck>);
338+
static_assert(std::is_nothrow_destructible_v<CScriptCheck>);
339+
334340
/** Initializes the script-execution cache */
335341
[[nodiscard]] bool InitScriptExecutionCache(size_t max_size_bytes);
336342

0 commit comments

Comments
 (0)