stringid: implement the size query

This commit is contained in:
Danny Robson 2022-05-13 10:02:06 +10:00
parent ef24f0bfda
commit 2b7dd99a68
2 changed files with 17 additions and 8 deletions

View File

@ -54,7 +54,15 @@ stringid::find (std::string_view const &key) const
///////////////////////////////////////////////////////////////////////////////
void
stringid::clear (void)
stringid::clear (void) noexcept
{
m_map.clear ();
}
//-----------------------------------------------------------------------------
std::size_t
stringid::size (void) const noexcept
{
return m_map.size ();
}

View File

@ -3,11 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2014-2018 Danny Robson <danny@nerdcruft.net>
* Copyright:
* 2014-2018 Danny Robson <danny@nerdcruft.net>
* 2022 Danny Robson <danny@nerdcruft.net>
*/
#ifndef CRUFT_UTIL_STRINGID_HPP
#define CRUFT_UTIL_STRINGID_HPP
#pragma once
#include "view.hpp"
@ -63,12 +64,12 @@ namespace cruft {
///////////////////////////////////////////////////////////////////////
void clear (void);
void clear (void) noexcept;
std::size_t size (void) const noexcept;
private:
std::map<std::string const, id_t, std::less<>> m_map;
};
}
#endif