/// create an empty (zero-size) SBuf
SBuf();
SBuf(const SBuf &S);
+#if __cplusplus >= 201103L
SBuf(SBuf&& S) : store_(std::move(S.store_)), off_(S.off_), len_(S.len_) {
++stats.moves;
- S.store_=NULL;
+ S.store_=NULL; //RefCount supports NULL, and S is about to be destructed
S.off_=0;
- S.len_=0; //RefCount supports NULL
+ S.len_=0;
}
+#endif
/** Constructor: import c-style string
*
* Current SBuf will share backing store with the assigned one.
*/
SBuf& operator =(const SBuf & S) {return assign(S);}
+#if __cplusplus >= 201103L
SBuf& operator =(SBuf &&S) {
++stats.moves;
if (this != &S) {
}
return *this;
}
+#endif
/** Import a c-string into a SBuf, copying the data.
*
reference (p);
}
+#if __cplusplus >= 201103L
RefCount (RefCount &&p) : p_(std::move(p.p_)) {
p.p_=NULL;
}
+#endif
RefCount& operator = (const RefCount& p) {
// DO NOT CHANGE THE ORDER HERE!!!
return *this;
}
+#if __cplusplus >= 201103L
RefCount& operator = (RefCount&& p) {
if (this != &p) {
dereference(p.p_);
}
return *this;
}
+#endif
bool operator !() const { return !p_; }