From 5347fbb88952ca0dedc27935cc14f28a33be7cae Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 18 Sep 2018 16:36:03 +1000 Subject: [PATCH] stringid: use string_view for accessors --- stringid.cpp | 2 +- stringid.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stringid.cpp b/stringid.cpp index 54dff9dc..ea56784b 100644 --- a/stringid.cpp +++ b/stringid.cpp @@ -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 ()) diff --git a/stringid.hpp b/stringid.hpp index b7f5e01f..d49f9fdf 100644 --- a/stringid.hpp +++ b/stringid.hpp @@ -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 key) const { return find ( - std::string { + std::string_view { std::cbegin (key), std::cend (key) } @@ -64,7 +64,7 @@ namespace cruft { private: - std::map> m_map; + std::map> m_map; }; }