diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-03-12 09:52:33 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-03-12 09:52:33 +0000 |
| commit | 348e23dd8aa20cfe1957f30804f93f50ffd22e7b (patch) | |
| tree | e3b125b020a7eb88e5a2ffd2155e3cc906b67879 /src/shared_string.hh | |
| parent | 48436435140adf4cf502abd53316e9c4242ac5f2 (diff) | |
Remove unused StaticString
Diffstat (limited to 'src/shared_string.hh')
| -rw-r--r-- | src/shared_string.hh | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/shared_string.hh b/src/shared_string.hh index d19a8353..5c531ebd 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -14,8 +14,7 @@ struct StringData : UseMemoryDomain<MemoryDomain::SharedString> int refcount; int length; - StringData() = default; - constexpr StringData(int refcount, int length) : refcount(refcount), length(length) {} + constexpr StringData(int ref, int len) : refcount(ref), length(len) {} [[gnu::always_inline]] char* data() { return reinterpret_cast<char*>(this + 1); } @@ -43,13 +42,12 @@ struct StringData : UseMemoryDomain<MemoryDomain::SharedString> friend void inc_ref_count(StringData* s, void*) { - if (s->refcount != -1) - ++s->refcount; + ++s->refcount; } friend void dec_ref_count(StringData* s, void*) { - if (s->refcount != -1 and --s->refcount == 0) + if (--s->refcount == 0) StringData::destroy(s); } }; @@ -61,22 +59,6 @@ inline StringDataPtr operator"" _ss(const char* ptr, size_t len) return StringData::create({ptr, (int)len}); } -template<size_t len> -struct StaticStringData : StringData -{ - template<size_t... I> constexpr - StaticStringData(const char (&literal)[len], IndexSequence<I...>) - : StringData{-1, len}, data{literal[I]...} {} - - const char data[len]; -}; - -template<size_t len> -constexpr StaticStringData<len> static_storage(const char (&literal)[len]) -{ - return { literal, make_index_sequence<len>() }; -} - class SharedString : public StringView { public: |
