From 043b2a0aeb0127a048606f43cad3560d0ecd7ae7 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 19 Aug 2026 22:28:46 +0300 Subject: [PATCH 1/3] Delete default and move operations on hash tables Owning map/set types were accidentally move-constructible and move-assignable, which can silently transfer GPU storage. Match the copy members and disable default construction too. Fixes #612 Signed-off-by: Aaron --- include/cuco/static_map.cuh | 14 ++++---------- include/cuco/static_multimap.cuh | 14 ++++---------- include/cuco/static_multiset.cuh | 14 ++++---------- include/cuco/static_set.cuh | 14 ++++---------- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/include/cuco/static_map.cuh b/include/cuco/static_map.cuh index 773a00fd3..2302161c1 100644 --- a/include/cuco/static_map.cuh +++ b/include/cuco/static_map.cuh @@ -121,18 +121,12 @@ class static_map { storage_ref_type, Operators...>; ///< Non-owning container ref type + static_map() = delete; static_map(static_map const&) = delete; static_map& operator=(static_map const&) = delete; - - static_map(static_map&&) = default; ///< Move constructor - - /** - * @brief Replaces the contents of the container with another container. - * - * @return Reference of the current map object - */ - static_map& operator=(static_map&&) = default; - ~static_map() = default; + static_map(static_map&&) = delete; + static_map& operator=(static_map&&) = delete; + ~static_map() = default; /** * @brief Constructs a statically-sized map with the specified initial capacity, sentinel values diff --git a/include/cuco/static_multimap.cuh b/include/cuco/static_multimap.cuh index 08166b503..44de96d63 100644 --- a/include/cuco/static_multimap.cuh +++ b/include/cuco/static_multimap.cuh @@ -117,18 +117,12 @@ class static_multimap { storage_ref_type, Operators...>; ///< Non-owning container ref type + static_multimap() = delete; static_multimap(static_multimap const&) = delete; static_multimap& operator=(static_multimap const&) = delete; - - static_multimap(static_multimap&&) = default; ///< Move constructor - - /** - * @brief Replaces the contents of the container with another container. - * - * @return Reference of the current map object - */ - static_multimap& operator=(static_multimap&&) = default; - ~static_multimap() = default; + static_multimap(static_multimap&&) = delete; + static_multimap& operator=(static_multimap&&) = delete; + ~static_multimap() = default; /** * @brief Constructs a statically-sized map with the specified initial capacity, sentinel values diff --git a/include/cuco/static_multiset.cuh b/include/cuco/static_multiset.cuh index 77d3b16c9..e728eae84 100644 --- a/include/cuco/static_multiset.cuh +++ b/include/cuco/static_multiset.cuh @@ -99,18 +99,12 @@ class static_multiset { storage_ref_type, Operators...>; ///< Non-owning container ref type + static_multiset() = delete; static_multiset(static_multiset const&) = delete; static_multiset& operator=(static_multiset const&) = delete; - - static_multiset(static_multiset&&) = default; ///< Move constructor - - /** - * @brief Replaces the contents of the container with another container. - * - * @return Reference of the current multiset object - */ - static_multiset& operator=(static_multiset&&) = default; - ~static_multiset() = default; + static_multiset(static_multiset&&) = delete; + static_multiset& operator=(static_multiset&&) = delete; + ~static_multiset() = default; /** * @brief Constructs a statically-sized multiset with the specified initial capacity, sentinel diff --git a/include/cuco/static_set.cuh b/include/cuco/static_set.cuh index a5f4145ea..8e72c7904 100644 --- a/include/cuco/static_set.cuh +++ b/include/cuco/static_set.cuh @@ -104,18 +104,12 @@ class static_set { storage_ref_type, Operators...>; ///< Non-owning container ref type + static_set() = delete; static_set(static_set const&) = delete; static_set& operator=(static_set const&) = delete; - - static_set(static_set&&) = default; ///< Move constructor - - /** - * @brief Replaces the contents of the container with another container. - * - * @return Reference of the current set object - */ - static_set& operator=(static_set&&) = default; - ~static_set() = default; + static_set(static_set&&) = delete; + static_set& operator=(static_set&&) = delete; + ~static_set() = default; /** * @brief Constructs a statically-sized set with the specified initial capacity, sentinel values From 69b7cea0303a65c0b85f3b8d37204299cfea24bc Mon Sep 17 00:00:00 2001 From: Yunsong Wang Date: Mon, 24 Aug 2026 22:43:21 +0000 Subject: [PATCH 2/3] Delete default/move ctor and assignment on dynamic_map --- include/cuco/dynamic_map.cuh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/include/cuco/dynamic_map.cuh b/include/cuco/dynamic_map.cuh index 91a117eba..c7b97fb69 100644 --- a/include/cuco/dynamic_map.cuh +++ b/include/cuco/dynamic_map.cuh @@ -57,18 +57,12 @@ class dynamic_map { using hasher = typename map_type::hasher; ///< Hash function type using mapped_type = T; ///< Payload type + dynamic_map() = delete; dynamic_map(dynamic_map const&) = delete; dynamic_map& operator=(dynamic_map const&) = delete; - - dynamic_map(dynamic_map&&) = default; ///< Move constructor - - /** - * @brief Replaces the contents of the container with another container. - * - * @return Reference of the current map object - */ - dynamic_map& operator=(dynamic_map&&) = default; - ~dynamic_map() = default; + dynamic_map(dynamic_map&&) = delete; + dynamic_map& operator=(dynamic_map&&) = delete; + ~dynamic_map() = default; /** * @brief Constructs a dynamically-sized map. From a58244e5ff627987ea5b132c8763d1c4f6f43041 Mon Sep 17 00:00:00 2001 From: Yunsong Wang Date: Wed, 26 Aug 2026 04:07:16 +0000 Subject: [PATCH 3/3] Restore move constructor on hash tables --- include/cuco/dynamic_map.cuh | 2 +- include/cuco/static_map.cuh | 2 +- include/cuco/static_multimap.cuh | 2 +- include/cuco/static_multiset.cuh | 2 +- include/cuco/static_set.cuh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/cuco/dynamic_map.cuh b/include/cuco/dynamic_map.cuh index c7b97fb69..334b2ffb3 100644 --- a/include/cuco/dynamic_map.cuh +++ b/include/cuco/dynamic_map.cuh @@ -60,7 +60,7 @@ class dynamic_map { dynamic_map() = delete; dynamic_map(dynamic_map const&) = delete; dynamic_map& operator=(dynamic_map const&) = delete; - dynamic_map(dynamic_map&&) = delete; + dynamic_map(dynamic_map&&) noexcept = default; ///< Move constructor dynamic_map& operator=(dynamic_map&&) = delete; ~dynamic_map() = default; diff --git a/include/cuco/static_map.cuh b/include/cuco/static_map.cuh index 2302161c1..48ba98041 100644 --- a/include/cuco/static_map.cuh +++ b/include/cuco/static_map.cuh @@ -124,7 +124,7 @@ class static_map { static_map() = delete; static_map(static_map const&) = delete; static_map& operator=(static_map const&) = delete; - static_map(static_map&&) = delete; + static_map(static_map&&) noexcept = default; ///< Move constructor static_map& operator=(static_map&&) = delete; ~static_map() = default; diff --git a/include/cuco/static_multimap.cuh b/include/cuco/static_multimap.cuh index 44de96d63..39e958889 100644 --- a/include/cuco/static_multimap.cuh +++ b/include/cuco/static_multimap.cuh @@ -120,7 +120,7 @@ class static_multimap { static_multimap() = delete; static_multimap(static_multimap const&) = delete; static_multimap& operator=(static_multimap const&) = delete; - static_multimap(static_multimap&&) = delete; + static_multimap(static_multimap&&) noexcept = default; ///< Move constructor static_multimap& operator=(static_multimap&&) = delete; ~static_multimap() = default; diff --git a/include/cuco/static_multiset.cuh b/include/cuco/static_multiset.cuh index e728eae84..77bb1ffb0 100644 --- a/include/cuco/static_multiset.cuh +++ b/include/cuco/static_multiset.cuh @@ -102,7 +102,7 @@ class static_multiset { static_multiset() = delete; static_multiset(static_multiset const&) = delete; static_multiset& operator=(static_multiset const&) = delete; - static_multiset(static_multiset&&) = delete; + static_multiset(static_multiset&&) noexcept = default; ///< Move constructor static_multiset& operator=(static_multiset&&) = delete; ~static_multiset() = default; diff --git a/include/cuco/static_set.cuh b/include/cuco/static_set.cuh index 8e72c7904..df162a751 100644 --- a/include/cuco/static_set.cuh +++ b/include/cuco/static_set.cuh @@ -107,7 +107,7 @@ class static_set { static_set() = delete; static_set(static_set const&) = delete; static_set& operator=(static_set const&) = delete; - static_set(static_set&&) = delete; + static_set(static_set&&) noexcept = default; ///< Move constructor static_set& operator=(static_set&&) = delete; ~static_set() = default;