Change c++17 to c++20. Fixed formatting on assignment from double.

This commit is contained in:
Brad Arant committed 2024-07-09 08:21:11 -07:00
1 parent 1c7f961255
commit bfe5283492
4 files changed
+13 -8

No files matched your search

+12 -7
View File
@@ -3,6 +3,7 @@
#include "uuid/uuid.h"
#include <cstring>
#include <string>
#include <format>
#include <iomanip>
#include <stdlib.h>
@@ -83,10 +84,12 @@ namespace coreutils {
}
MString::MString(double value) {
std::string data = std::to_string(value);
setSize(data.length());
memcpy(this->data, (char *)data.c_str(), data.length());
cursor = this->data;
std::stringstream temp;
temp << std::format("{}", value);
std::string temp2 = temp.str();
setSize(temp2.length());
memcpy(this->data, (char *)temp2.data(), temp2.length());
cursor = this->data;
}
MString::~MString() {
@@ -130,9 +133,11 @@ namespace coreutils {
}
MString &MString::operator=(double value) {
std::string data = std::to_string(value);
setSize(data.length());
memcpy(this->data, (char *)data.c_str(), data.length());
std::stringstream temp;
temp << std::format("{}", value);
std::string temp2 = temp.str();
setSize(temp2.length());
memcpy(this->data, (char *)temp2.data(), temp2.length());
cursor = this->data;
return *this;
}