From: Sage Weil Date: Fri, 23 Dec 2016 17:20:27 +0000 (-0500) Subject: include/denc: parameterize string by allocator X-Git-Tag: v12.0.0~181^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f9e3a786f80c36954c1cb0c77f96cda0314357ca;p=ceph.git include/denc: parameterize string by allocator Signed-off-by: Sage Weil --- diff --git a/src/include/denc.h b/src/include/denc.h index e137ee47f5e3..3ae4d6eab3c9 100644 --- a/src/include/denc.h +++ b/src/include/denc.h @@ -520,20 +520,25 @@ inline typename std::enable_if -struct denc_traits { +template +struct denc_traits,A>> { enum { supported = true }; enum { featured = false }; enum { bounded = false }; - static void bound_encode(const std::string& s, size_t& p, uint64_t f=0) { + static void bound_encode(const std::basic_string,A>& s, size_t& p, + uint64_t f=0) { p += sizeof(uint32_t) + s.size(); } - static void encode(const std::string& s, buffer::list::contiguous_appender& p, + static void encode(const std::basic_string,A>& s, + buffer::list::contiguous_appender& p, uint64_t f=0) { ::denc((uint32_t)s.size(), p); memcpy(p.get_pos_add(s.size()), s.data(), s.size()); } - static void decode(std::string& s, buffer::ptr::iterator& p, uint64_t f=0) { + static void decode(std::basic_string,A>& s, + buffer::ptr::iterator& p, + uint64_t f=0) { uint32_t len; ::denc(len, p); s.clear();