diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/bson/bsonobj.h | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/record_data.h | 5 | ||||
-rw-r--r-- | src/mongo/dbtests/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/shared_buffer_test.cpp (renamed from src/mongo/dbtests/shared_buffer.cpp) | 4 | ||||
-rw-r--r-- | src/mongo/util/shared_buffer.h | 5 |
5 files changed, 18 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonobj.h b/src/mongo/bson/bsonobj.h index 69e85b2117d..2faa7c9cc09 100644 --- a/src/mongo/bson/bsonobj.h +++ b/src/mongo/bson/bsonobj.h @@ -33,6 +33,7 @@ #include <list> #include <set> #include <string> +#include <type_traits> #include <utility> #include <vector> @@ -591,6 +592,9 @@ private: ConstSharedBuffer _ownedBuffer; }; +MONGO_STATIC_ASSERT(std::is_nothrow_move_constructible_v<BSONObj>); +MONGO_STATIC_ASSERT(std::is_nothrow_move_assignable_v<BSONObj>); + std::ostream& operator<<(std::ostream& s, const BSONObj& o); std::ostream& operator<<(std::ostream& s, const BSONElement& e); diff --git a/src/mongo/db/storage/record_data.h b/src/mongo/db/storage/record_data.h index 5a4017e4e08..5cc99b7f50d 100644 --- a/src/mongo/db/storage/record_data.h +++ b/src/mongo/db/storage/record_data.h @@ -29,6 +29,8 @@ #pragma once +#include <type_traits> + #include "mongo/bson/bsonobj.h" #include "mongo/util/shared_buffer.h" @@ -98,4 +100,7 @@ private: SharedBuffer _ownedData; }; +MONGO_STATIC_ASSERT(std::is_nothrow_move_constructible_v<RecordData>); +MONGO_STATIC_ASSERT(std::is_nothrow_move_assignable_v<RecordData>); + } // namespace mongo diff --git a/src/mongo/dbtests/SConscript b/src/mongo/dbtests/SConscript index c53dcb90f96..1b887519b33 100644 --- a/src/mongo/dbtests/SConscript +++ b/src/mongo/dbtests/SConscript @@ -85,7 +85,7 @@ if not has_option('noshell') and usemozjs: 'mock_dbclient_conn_test.cpp', 'mock_replica_set_test.cpp', 'multikey_paths_test.cpp', - 'shared_buffer.cpp', + 'shared_buffer_test.cpp', 'pdfiletests.cpp', 'plan_executor_invalidation_test.cpp', 'plan_ranking.cpp', diff --git a/src/mongo/dbtests/shared_buffer.cpp b/src/mongo/dbtests/shared_buffer_test.cpp index 1cb632d7b8c..37d259114d6 100644 --- a/src/mongo/dbtests/shared_buffer.cpp +++ b/src/mongo/dbtests/shared_buffer_test.cpp @@ -29,9 +29,11 @@ #include "mongo/platform/basic.h" +#include "mongo/util/shared_buffer.h" + #include "mongo/base/string_data.h" + #include "mongo/unittest/unittest.h" -#include "mongo/util/shared_buffer.h" namespace mongo { namespace { diff --git a/src/mongo/util/shared_buffer.h b/src/mongo/util/shared_buffer.h index b0bc09c769b..00000d0a3d5 100644 --- a/src/mongo/util/shared_buffer.h +++ b/src/mongo/util/shared_buffer.h @@ -30,10 +30,12 @@ #pragma once #include <algorithm> +#include <type_traits> #include <boost/intrusive_ptr.hpp> #include "mongo/platform/atomic_word.h" + #include "mongo/util/allocator.h" #include "mongo/util/assert_util.h" @@ -177,6 +179,9 @@ private: boost::intrusive_ptr<Holder> _holder; }; +MONGO_STATIC_ASSERT(std::is_nothrow_move_constructible_v<SharedBuffer>); +MONGO_STATIC_ASSERT(std::is_nothrow_move_assignable_v<SharedBuffer>); + inline void swap(SharedBuffer& one, SharedBuffer& two) { one.swap(two); } |