Fix ArgBuffer String Serialization (#999)

This commit is contained in:
Michael Flaherty 2019-05-04 01:46:55 -07:00 committed by GitHub
parent e1648ba8f9
commit 9cd2a74271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@
template <typename T, typename...Rest>
class ArgBuffer {
public:
ArgBuffer(T t, Rest... rest) {
ArgBuffer(const T& t, const Rest&... rest) {
unsigned char *ptr = buff;
buildbuffer(&ptr, t, rest...);
}
@ -60,13 +60,13 @@ private:
}
template <typename K>
void buildbuffer(unsigned char **ptr, K k) {
void buildbuffer(unsigned char **ptr, K& k) {
memcpy(*ptr, &k, sizeof(k));
*ptr += sizeof(K);
}
template <typename K, typename... Kn>
void buildbuffer(unsigned char **ptr, K k, Kn... kn) {
void buildbuffer(unsigned char **ptr, K& k, Kn&... kn) {
buildbuffer(ptr, k);
if (sizeof...(kn)!=0)
buildbuffer(ptr, kn...);