@@ -1002,44 +1002,6 @@ namespace hud
10021002 reset_control_and_slot ();
10031003 }
10041004
1005- /* *
1006- * Insert a key in the hashset.
1007- * @param key The key associated with the `value`
1008- * @param args List of arguments pass to `value_type` constructor after the `key` itself
1009- * @return Iterator to the `value`
1010- */
1011- template <typename ... args_t >
1012- requires (hud::is_constructible_v<slot_type, key_type, args_t ...>)
1013- constexpr iterator add (key_type &&key, args_t &&...args) noexcept
1014- {
1015- hud::pair<usize, bool > res {find_or_insert_no_construct (key)};
1016- slot_type *slot_ptr {slot_ptr_ + res.first };
1017- if (res.second )
1018- {
1019- hud::memory::construct_object_at (slot_ptr, hud::move (key), hud::forward<args_t >(args)...);
1020- }
1021- return {control_ptr_ + res.first , slot_ptr};
1022- }
1023-
1024- /* *
1025- * Insert a key in the hashset.
1026- * @param key The key associated with the `value`
1027- * @param args List of arguments pass to `value_type` constructor after the `key` itself
1028- * @return Iterator to the `value`
1029- */
1030- template <typename ... args_t >
1031- requires (hud::is_constructible_v<slot_type, const key_type &, args_t ...>)
1032- constexpr iterator add (const key_type &key, args_t &&...args) noexcept
1033- {
1034- hud::pair<usize, bool > res {find_or_insert_no_construct (key)};
1035- slot_type *slot_ptr {slot_ptr_ + res.first };
1036- if (res.second )
1037- {
1038- hud::memory::construct_object_at (slot_ptr, key, hud::forward<args_t >(args)...);
1039- }
1040- return {control_ptr_ + res.first , slot_ptr};
1041- }
1042-
10431005 /* * Find a key and return an iterator to the value. */
10441006 template <typename K>
10451007 [[nodiscard]]
@@ -1210,6 +1172,45 @@ namespace hud
12101172 return const_iterator {control_ptr_sentinel ()};
12111173 }
12121174
1175+ protected:
1176+ /* *
1177+ * Insert a key in the hashset and pass
1178+ * @param key The key associated with the `value`
1179+ * @param args List of arguments pass to `value_type` constructor after the `key` itself
1180+ * @return Iterator to the `value`
1181+ */
1182+ template <typename ... args_t >
1183+ requires (hud::is_constructible_v<slot_type, key_type, args_t ...>)
1184+ constexpr iterator add (key_type &&key, args_t &&...args) noexcept
1185+ {
1186+ hud::pair<usize, bool > res {find_or_insert_no_construct (key)};
1187+ slot_type *slot_ptr {slot_ptr_ + res.first };
1188+ if (res.second )
1189+ {
1190+ hud::memory::construct_object_at (slot_ptr, hud::move (key), hud::forward<args_t >(args)...);
1191+ }
1192+ return {control_ptr_ + res.first , slot_ptr};
1193+ }
1194+
1195+ /* *
1196+ * Insert a key in the hashset.
1197+ * @param key The key associated with the `value`
1198+ * @param args List of arguments pass to `value_type` constructor after the `key` itself
1199+ * @return Iterator to the `value`
1200+ */
1201+ template <typename ... args_t >
1202+ requires (hud::is_constructible_v<slot_type, const key_type &, args_t ...>)
1203+ constexpr iterator add (const key_type &key, args_t &&...args) noexcept
1204+ {
1205+ hud::pair<usize, bool > res {find_or_insert_no_construct (key)};
1206+ slot_type *slot_ptr {slot_ptr_ + res.first };
1207+ if (res.second )
1208+ {
1209+ hud::memory::construct_object_at (slot_ptr, key, hud::forward<args_t >(args)...);
1210+ }
1211+ return {control_ptr_ + res.first , slot_ptr};
1212+ }
1213+
12131214 private:
12141215 template <typename u_key_type>
12151216 [[nodiscard]] constexpr u64 compute_hash (const u_key_type &key) noexcept
@@ -1902,11 +1903,6 @@ namespace hud
19021903
19031904 } // namespace details::hashset
19041905
1905- // using hashset_default_hasher = details::hashset::default_hasher;
1906-
1907- // template<typename element_t>
1908- // using hashset_default_key_equal = details::hashset::default_equal<element_t>;
1909-
19101906 using hashset_default_allocator = details::hashset::default_allocator;
19111907
19121908 template <
0 commit comments