diff --git a/MString.cpp b/MString.cpp index 7e03bac..52a800c 100644 --- a/MString.cpp +++ b/MString.cpp @@ -3,6 +3,7 @@ #include "uuid/uuid.h" #include #include +#include #include #include @@ -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; } diff --git a/compile b/compile index 93380a0..12ab0a6 100755 --- a/compile +++ b/compile @@ -5,7 +5,7 @@ do filename="${file%.*}" list="$list $filename.o" echo -n "Compiling $filename..." - g++ -g -c $file -std=c++17 & + g++ -g -c $file -std=c++20 & if [ $? = '0' ] then echo "OK" diff --git a/testing/mstring_test b/testing/mstring_test index 83b1d3e..2a8f6aa 100755 Binary files a/testing/mstring_test and b/testing/mstring_test differ diff --git a/testing/zstring_test b/testing/zstring_test index ed824d1..f39d332 100755 Binary files a/testing/zstring_test and b/testing/zstring_test differ