summaryrefslogtreecommitdiff
path: root/tools/minicargo/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/minicargo/helpers.h')
-rw-r--r--tools/minicargo/helpers.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/minicargo/helpers.h b/tools/minicargo/helpers.h
index 1099778b..d913e3c2 100644
--- a/tools/minicargo/helpers.h
+++ b/tools/minicargo/helpers.h
@@ -2,6 +2,7 @@
#include <string>
#include <cstring>
+#include <iostream>
namespace helpers {
@@ -23,10 +24,17 @@ public:
return false;
return s[m_len] == '\0';
}
+ operator ::std::string() const {
+ return ::std::string { m_start, m_start + m_len };
+ }
friend ::std::string& operator+=(::std::string& x, const string_view& sv) {
x.append(sv.m_start, sv.m_start+sv.m_len);
return x;
}
+ friend ::std::ostream& operator<<(::std::ostream& os, const string_view& sv) {
+ os.write(sv.m_start, sv.m_len);
+ return os;
+ }
};