mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-24 17:01:48 +01:00
audio_core/sink_details: Change std::string parameter into std::string_view
The given string is only ever used for lookup and comparison, so we can just utilize a non-owning view to string data here
This commit is contained in:
parent
2ba62ec196
commit
93bd630d40
@ -30,7 +30,7 @@ const std::vector<SinkDetails> g_sink_details = {
|
|||||||
[] { return std::vector<std::string>{"null"}; }},
|
[] { return std::vector<std::string>{"null"}; }},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SinkDetails& GetSinkDetails(std::string sink_id) {
|
const SinkDetails& GetSinkDetails(std::string_view sink_id) {
|
||||||
auto iter =
|
auto iter =
|
||||||
std::find_if(g_sink_details.begin(), g_sink_details.end(),
|
std::find_if(g_sink_details.begin(), g_sink_details.end(),
|
||||||
[sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; });
|
[sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; });
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -30,6 +32,6 @@ struct SinkDetails {
|
|||||||
|
|
||||||
extern const std::vector<SinkDetails> g_sink_details;
|
extern const std::vector<SinkDetails> g_sink_details;
|
||||||
|
|
||||||
const SinkDetails& GetSinkDetails(std::string sink_id);
|
const SinkDetails& GetSinkDetails(std::string_view sink_id);
|
||||||
|
|
||||||
} // namespace AudioCore
|
} // namespace AudioCore
|
||||||
|
Loading…
Reference in New Issue
Block a user