Skip to content

Commit

Permalink
Use (non-mutable) std::shared_ptr instead
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Mar 14, 2023
1 parent 74e2fe9 commit 6a8e923
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions containers/src/Kokkos_UnorderedMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class UnorderedMap {
: m_bounded_insert(true),
m_hasher(hasher),
m_equal_to(equal_to),
m_size("m_size"),
m_size(std::make_shared<size_type>()),
m_available_indexes(calculate_capacity(capacity_hint)),
m_hash_lists(view_alloc(WithoutInitializing, "UnorderedMap hash list"),
Impl::find_hash_size(capacity())),
Expand Down Expand Up @@ -315,7 +315,7 @@ class UnorderedMap {
Kokkos::deep_copy(m_keys, tmp);
}
Kokkos::deep_copy(m_scalars, 0);
m_size() = 0;
*m_size = 0;
}

KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const {
Expand Down Expand Up @@ -369,10 +369,10 @@ class UnorderedMap {
size_type size() const {
if (capacity() == 0u) return 0u;
if (modified()) {
m_size() = m_available_indexes.count();
*m_size = m_available_indexes.count();
reset_flag(modified_idx);
}
return m_size();
return *m_size;
}

/// \brief The current number of failed insert() calls.
Expand Down Expand Up @@ -818,7 +818,7 @@ class UnorderedMap {
bool m_bounded_insert;
hasher_type m_hasher;
equal_to_type m_equal_to;
mutable Kokkos::View<size_type, Kokkos::HostSpace> m_size;
std::shared_ptr<size_type> m_size;
bitset_type m_available_indexes;
size_type_view m_hash_lists;
size_type_view m_next_index;
Expand Down

0 comments on commit 6a8e923

Please sign in to comment.