Skip to content

Commit

Permalink
HashMultiMap::GetCount, HashMultiMap::IsEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Oct 27, 2024
1 parent a845ef4 commit 61dd198
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion include/momo/HashMultiMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,21 @@ class HashMultiMap
return mHashMap.GetMemManager();
}

size_t GetValueCount() const noexcept
size_t GetValueCount() const noexcept // deprecated?
{
return mValueCount;
}

size_t GetCount() const noexcept
{
return mValueCount;
}

bool IsEmpty() const noexcept
{
return mValueCount == 0;
}

void Clear() noexcept
{
if (!mValueCrew.IsNull())
Expand Down
6 changes: 3 additions & 3 deletions include/momo/stdish/unordered_multimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ class unordered_multimap

size_type size() const noexcept
{
return mHashMultiMap.GetValueCount();
return mHashMultiMap.GetCount();
}

MOMO_NODISCARD bool empty() const noexcept
{
return size() == 0;
return mHashMultiMap.IsEmpty();
}

void clear() noexcept
Expand Down Expand Up @@ -623,7 +623,7 @@ class unordered_multimap
{
if (mHashMultiMap.GetKeyCount() != right.mHashMultiMap.GetKeyCount())
return false;
if (mHashMultiMap.GetValueCount() != right.mHashMultiMap.GetValueCount())
if (mHashMultiMap.GetCount() != right.mHashMultiMap.GetCount())
return false;
for (typename HashMultiMap::ConstKeyIterator::Reference ref : mHashMultiMap.GetKeyBounds())
{
Expand Down
2 changes: 1 addition & 1 deletion test/sources/SimpleHashTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class SimpleHashTester
HashMultiMap mmap2;
mmap2 = mmap;
//mmap2.Shrink();
assert(mmap.GetKeyCount() == mmap2.GetKeyCount() && mmap.GetValueCount() == mmap2.GetValueCount());
assert(mmap.GetKeyCount() == mmap2.GetKeyCount() && mmap.GetCount() == mmap2.GetValueCount());
}

template<typename HashBucket, size_t size, size_t alignment>
Expand Down

0 comments on commit 61dd198

Please sign in to comment.