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

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

View File

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

View File

@ -5,7 +5,7 @@ do
filename="${file%.*}" filename="${file%.*}"
list="$list $filename.o" list="$list $filename.o"
echo -n "Compiling $filename..." echo -n "Compiling $filename..."
g++ -g -c $file -std=c++17 & g++ -g -c $file -std=c++20 &
if [ $? = '0' ] if [ $? = '0' ]
then then
echo "OK" echo "OK"

Binary file not shown.

Binary file not shown.