diff options
author | John Fultz <jfultz@wolfram.com> | 2019-03-19 11:16:43 -0500 |
---|---|---|
committer | John Fultz <jfultz@wolfram.com> | 2019-07-21 02:02:55 -0700 |
commit | e7f645d4f5030e52b1c9f27dc3fbf2c20fd47cd5 (patch) | |
tree | 9e0d59f8b491091cfa36931982d8a96c599f5106 | |
parent | 4cd51c4a7233dd4334832cc05bfaa91221d98916 (diff) |
Move constructor for FixedLengthString.
-rw-r--r-- | fixedstring.h | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |