Removed stringstream from assignment from double.
This commit is contained in:
parent
bfe5283492
commit
cca957b948
16
MString.cpp
16
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user