include/CompatSet: get_name() returns std::string_view

Creating a temporary copy is useless overhead for all callers.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
This commit is contained in:
Max Kellermann 2024-10-16 20:01:20 +02:00
parent 5a45cd213e
commit 7b5e7c4260

View File

@ -62,7 +62,7 @@ struct CompatSet {
/**
* Getter instead of using name[] to be const safe
*/
std::string get_name(uint64_t const f) const {
std::string_view get_name(uint64_t const f) const noexcept {
std::map<uint64_t, std::string>::const_iterator i = names.find(f);
ceph_assert(i != names.end());
return i->second;