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 <cstring>
#include <string>
#include <format>
#include <iomanip>
#include <stdlib.h>
@ -83,9 +84,11 @@ 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());
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;
}
@ -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;
}

View File

@ -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"

Binary file not shown.

Binary file not shown.