Implement copy constructors (#12970)

This commit is contained in:
Duncan authored and GitHub committed 2020-09-19 13:58:05 +01:00
1 parent 4a79e9305f
commit 124161b459
1 file changed
+21
+21
View File
@@ -101,6 +101,27 @@ public:
{
}
Formatter(const Formatter& other)
{
*this = other;
}
Formatter& operator=(const Formatter& other)
{
// If using global or not
if (other.StartBuf == other.Buffer.data())
{
std::copy(std::begin(other.Buffer), std::end(other.Buffer), std::begin(Buffer));
StartBuf = Buffer.data();
}
else
{
StartBuf = other.StartBuf;
}
CurrentBuf = StartBuf + other.NumBytes();
return *this;
}
static Formatter Common()
{
return Formatter{ gCommonFormatArgs };