diff options
author | John Hodge <tpg@mutabah.net> | 2017-08-21 22:32:48 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-08-21 22:32:48 +0800 |
commit | 8ca7753af27a431c9b2f8bec98b5cecc83fa452d (patch) | |
tree | 44dd706522882e91540d06b9ce226b9836513075 /tools/minicargo/helpers.h | |
parent | af317dcd9059ee78e4c8f36d9c67eb38fdf07709 (diff) | |
download | mrust-8ca7753af27a431c9b2f8bec98b5cecc83fa452d.tar.gz |
minicargo - Rough support for build scripts (override file only)
Diffstat (limited to 'tools/minicargo/helpers.h')
-rw-r--r-- | tools/minicargo/helpers.h | 8 |
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; + } }; |