diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/salticidae/stream.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index e7e5640..5f54195 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -98,12 +98,14 @@ class DataStream { } template<typename T> - typename std::enable_if<is_ranged<T>::value, DataStream &>::type - operator<<(const T &d) { + typename std::enable_if<is_ranged<T>::value>::type + put_data(const T &d) { buffer.insert(buffer.end(), d.begin(), d.end()); - return *this; } + DataStream &operator<<(const std::string &d) { put_data(d); return *this; } + DataStream &operator<<(const bytearray_t &d) { put_data(d); return *this; } + void put_data(const uint8_t *begin, const uint8_t *end) { size_t len = end - begin; buffer.resize(buffer.size() + len); @@ -121,8 +123,7 @@ class DataStream { } template<typename T> - typename std::enable_if<!is_ranged<T>::value && - !std::is_integral<T>::value, DataStream &>::type + typename std::enable_if<!std::is_integral<T>::value, DataStream &>::type operator<<(const T &obj) { obj.serialize(*this); return *this; |