]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- use string_view to reduce number of functions 1166/head
authorArvin Schnell <aschnell@suse.de>
Wed, 1 Jul 2026 15:45:40 +0000 (17:45 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 1 Jul 2026 15:45:40 +0000 (17:45 +0200)
snapper/SystemCmd.h

index bf9346447e3ea4acce8e45fe7cf4a9d44a3dd0eb..f8dcb0ff17b09383b281fa8fd7cc3a8a1276756a 100644 (file)
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 #include <cstdio>
 #include <string>
+#include <string_view>
 #include <vector>
 #include <initializer_list>
 #include <boost/noncopyable.hpp>
@@ -36,6 +37,7 @@
 namespace snapper
 {
     using std::string;
+    using std::string_view;
     using std::vector;
 
 
@@ -56,8 +58,7 @@ namespace snapper
 
            const vector<string>& 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<string>& args)
                { values.insert(values.end(), args.begin(), args.end()); return *this; }