diff --git a/MString.cpp b/MString.cpp index 52a800c..1d9ec32 100644 --- a/MString.cpp +++ b/MString.cpp @@ -84,11 +84,9 @@ namespace coreutils { } MString::MString(double value) { - std::stringstream temp; - temp << std::format("{}", value); - std::string temp2 = temp.str(); - setSize(temp2.length()); - memcpy(this->data, (char *)temp2.data(), temp2.length()); + std::string temp = std::format("{}", value); + setSize(temp.length()); + memcpy(this->data, (char *)temp.data(), temp.length()); cursor = this->data; } @@ -133,11 +131,9 @@ namespace coreutils { } MString &MString::operator=(double value) { - std::stringstream temp; - temp << std::format("{}", value); - std::string temp2 = temp.str(); - setSize(temp2.length()); - memcpy(this->data, (char *)temp2.data(), temp2.length()); + std::string temp = std::format("{}", value); + setSize(temp.length()); + memcpy(this->data, (char *)temp.data(), temp.length()); cursor = this->data; return *this; } diff --git a/testing/compile b/testing/compile index 12cdd09..26ae112 100755 --- a/testing/compile +++ b/testing/compile @@ -1,4 +1,4 @@ #!/bin/bash -g++ -g -o zstring_test zstring_test.cpp -I.. -L.. -lCoreUtils -g++ -g -o mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils +g++ -g -std=c++20 -o zstring_test zstring_test.cpp -I.. -L.. -lCoreUtils +g++ -g -std=c++20 -o mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils #g++ -o jstring_test jstring_test.cpp -I.. -L.. -lCoreUtils diff --git a/testing/mstring_test b/testing/mstring_test index 2a8f6aa..24bf1ac 100755 Binary files a/testing/mstring_test and b/testing/mstring_test differ diff --git a/testing/zstring_test b/testing/zstring_test index f39d332..5bfcf16 100755 Binary files a/testing/zstring_test and b/testing/zstring_test differ