From e7f645d4f5030e52b1c9f27dc3fbf2c20fd47cd5 Mon Sep 17 00:00:00 2001 From: John Fultz Date: Tue, 19 Mar 2019 11:16:43 -0500 Subject: Move constructor for FixedLengthString. --- fixedstring.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fixedstring.h') diff --git a/fixedstring.h b/fixedstring.h index cda0cf4..8c9c0da 100644 --- a/fixedstring.h +++ b/fixedstring.h @@ -42,6 +42,7 @@ class FixedLengthString FixedLengthString(size_type n, char c); FixedLengthString(const char* s); FixedLengthString(const FixedLengthString& s); + FixedLengthString(FixedLengthString&& s); const_iterator begin() const; const_iterator end() const; @@ -139,6 +140,14 @@ FixedLengthString::FixedLengthString(const FixedLengthString& s) m_end = m_data + sz; } +inline +FixedLengthString::FixedLengthString(FixedLengthString&& s) +{ + int sz = s.size(); + memcpy(m_data, s.m_data, sz); + m_end = m_data + sz; +} + inline FixedLengthString & FixedLengthString::operator=(const FixedLengthString &s) { -- cgit v1.2.3