about summary refs log tree commit diff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r--src/libutil/serialise.hh10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 9ba6391f817a..892ec4aa36de 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -13,6 +13,11 @@ struct Sink
     virtual ~Sink() { }
     virtual void operator () (const unsigned char * data, size_t len) = 0;
     virtual bool good() { return true; }
+
+    void operator () (const std::string & s)
+    {
+        (*this)((const unsigned char *) s.data(), s.size());
+    }
 };
 
 
@@ -28,6 +33,11 @@ struct BufferedSink : Sink
 
     void operator () (const unsigned char * data, size_t len) override;
 
+    void operator () (const std::string & s)
+    {
+        Sink::operator()(s);
+    }
+
     void flush();
 
     virtual void write(const unsigned char * data, size_t len) = 0;