stringid: use string_view for accessors

This commit is contained in:
Danny Robson 2018-09-18 16:36:03 +10:00
parent c2f203b5a7
commit 5347fbb889
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ stringid::add (std::string key)
///////////////////////////////////////////////////////////////////////////////
stringid::id_t
stringid::find (const std::string &key) const
stringid::find (std::string_view const &key) const
{
auto pos = m_map.find (key);
if (pos == m_map.end ())

View File

@ -43,7 +43,7 @@ namespace cruft {
///////////////////////////////////////////////////////////////////////
id_t find (const std::string&) const;
id_t find (std::string_view const&) const;
//---------------------------------------------------------------------
@ -51,7 +51,7 @@ namespace cruft {
id_t find (cruft::view<T> key) const
{
return find (
std::string {
std::string_view {
std::cbegin (key),
std::cend (key)
}
@ -64,7 +64,7 @@ namespace cruft {
private:
std::map<const std::string, id_t, std::less<>> m_map;
std::map<std::string const, id_t, std::less<>> m_map;
};
}