summaryrefslogtreecommitdiff
path: root/zen/string_base.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:21:59 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:21:59 +0200
commitd4af25c52a28b93484ffb55e0a8027bc4ce7856f (patch)
tree853d57468d6b370711e7a5dd2c3dc7d5bac81b10 /zen/string_base.h
parent5.8 (diff)
downloadFreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.tar.gz
FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.tar.bz2
FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.zip
5.9
Diffstat (limited to 'zen/string_base.h')
-rw-r--r--zen/string_base.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/zen/string_base.h b/zen/string_base.h
index 19bf6267..c3ddde36 100644
--- a/zen/string_base.h
+++ b/zen/string_base.h
@@ -209,10 +209,12 @@ public:
typedef Char& reference;
typedef const Char& const_reference;
typedef Char value_type;
- const Char* begin() const;
- const Char* end() const;
Char* begin();
- Char* end();
+ Char* end ();
+ const Char* begin() const;
+ const Char* end () const;
+ const Char* cbegin() const { return begin(); }
+ const Char* cend () const { return end(); }
//std::string functions
size_t length() const;
@@ -235,7 +237,8 @@ public:
void swap(Zbase& other);
void push_back(Char val) { operator+=(val); } //STL access
- Zbase& operator=(Zbase source);
+ Zbase& operator=(const Zbase& source);
+ Zbase& operator=(Zbase&& tmp);
Zbase& operator=(const Char* source);
Zbase& operator=(Char source);
Zbase& operator+=(const Zbase& other);
@@ -653,9 +656,18 @@ Zbase<Char, SP, AP>& Zbase<Char, SP, AP>::append(const Char* source, size_t len)
template <class Char, template <class, class> class SP, class AP> inline
-Zbase<Char, SP, AP>& Zbase<Char, SP, AP>::operator=(Zbase<Char, SP, AP> other) //unifying assignment: no need for r-value reference optimization!
+Zbase<Char, SP, AP>& Zbase<Char, SP, AP>::operator=(const Zbase<Char, SP, AP>& other)
+{
+ Zbase<Char, SP, AP>(other).swap(*this);
+ return *this;
+}
+
+
+template <class Char, template <class, class> class SP, class AP> inline
+Zbase<Char, SP, AP>& Zbase<Char, SP, AP>::operator=(Zbase<Char, SP, AP>&& tmp)
{
- swap(other);
+ //don't use unifying assignment but save one move-construction in the r-value case instead!
+ swap(tmp);
return *this;
}
bgstack15