]> git.tdb.fi Git - libs/core.git/blobdiff - source/strings/format.cpp
Make sure all classes have sensible copy semantics
[libs/core.git] / source / strings / format.cpp
index 1b8b4650a9efc852e2ab42268c775d7f5cb858f1..773eefac7fc30698bab7c8d6ebfca8fb1188de18 100644 (file)
@@ -11,6 +11,20 @@ Formatter::Formatter(const string &f):
        advance();
 }
 
+Formatter::Formatter(const Formatter &other):
+       fmt(other.fmt),
+       pos(fmt.begin()+(other.pos-other.fmt.begin())),
+       result(other.result)
+{ }
+
+Formatter &Formatter::operator=(const Formatter &other)
+{
+       fmt = other.fmt;
+       pos = fmt.begin()+(other.pos-other.fmt.begin());
+       result = other.result;
+       return *this;
+}
+
 const string &Formatter::str() const
 {
        if(pos!=fmt.end())