From add7ff74ca25ca2c9cc591abc484f8e6d38b2c39 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 11 Aug 2014 22:52:18 -0700 Subject: Optimize string literals in refcounted strings --- src/strings/rstring.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/strings/rstring.hpp') diff --git a/src/strings/rstring.hpp b/src/strings/rstring.hpp index fd3ee65..ad44beb 100644 --- a/src/strings/rstring.hpp +++ b/src/strings/rstring.hpp @@ -39,15 +39,17 @@ namespace strings size_t size; char body[]; }; - static - uint8_t empty_string_rep[sizeof(Rep) + 1]; - Rep *owned; + union + { + Rep *owned; + const char *begin; + } u; + const char *maybe_end; - template - void _assign(It b, It e); public: RString(); + RString(LString s); RString(const RString&); RString(RString&&); RString& operator = (const RString&); @@ -68,7 +70,6 @@ namespace strings RString(XString); template RString(const VString& v); - RString(LString s); iterator begin() const; iterator end() const; -- cgit v1.2.3-60-g2f50