std::string_view 的使用
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Core/Net_Adapter/Net_Adapter.h"
|
||||
#include "Global.h"
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
#undef interface
|
||||
|
||||
std::string default_config_path;
|
||||
@@ -124,9 +125,9 @@ void Device_Config::server(Global *g) {
|
||||
buffer << ifs.rdbuf();
|
||||
interface = buffer.str();
|
||||
}
|
||||
static auto set = [](std::string &interface, const std::string &token,
|
||||
const std::string &value) {
|
||||
std::string var_name = "${" + token + "}";
|
||||
static auto set = [](std::string &interface, std::string_view token,
|
||||
std::string_view value) {
|
||||
std::string var_name = "${" + std::string(token) + "}";
|
||||
auto size = var_name.size();
|
||||
size_t pos = interface.find(var_name);
|
||||
while (pos != std::string::npos) {
|
||||
|
||||
Reference in New Issue
Block a user