Change c++17 to c++20. Fixed formatting on assignment from double.
This commit is contained in:
parent
1c7f961255
commit
bfe5283492
19
MString.cpp
19
MString.cpp
@ -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;
|
||||
}
|
||||
|
2
compile
2
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"
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user