From: Arvin Schnell Date: Wed, 1 Jul 2026 15:45:40 +0000 (+0200) Subject: - use string_view to reduce number of functions X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ffbc385a64d3b494e0045c05fb4c2c1387e749b;p=thirdparty%2Fsnapper.git - use string_view to reduce number of functions --- diff --git a/snapper/SystemCmd.h b/snapper/SystemCmd.h index bf934644..f8dcb0ff 100644 --- a/snapper/SystemCmd.h +++ b/snapper/SystemCmd.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ namespace snapper { using std::string; + using std::string_view; using std::vector; @@ -56,8 +58,7 @@ namespace snapper const vector& get_values() const { return values; } - Args& operator<<(const char* arg) { values.push_back(arg); return *this; } - Args& operator<<(const string& arg) { values.push_back(arg); return *this; } + Args& operator<<(string_view arg) { values.emplace_back(arg); return *this; } Args& operator<<(const vector& args) { values.insert(values.end(), args.begin(), args.end()); return *this; }