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) {
|
MString::MString(double value) {
|
||||||
std::stringstream temp;
|
std::string temp = std::format("{}", value);
|
||||||
temp << std::format("{}", value);
|
setSize(temp.length());
|
||||||
std::string temp2 = temp.str();
|
memcpy(this->data, (char *)temp.data(), temp.length());
|
||||||
setSize(temp2.length());
|
|
||||||
memcpy(this->data, (char *)temp2.data(), temp2.length());
|
|
||||||
cursor = this->data;
|
cursor = this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,11 +131,9 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MString &MString::operator=(double value) {
|
MString &MString::operator=(double value) {
|
||||||
std::stringstream temp;
|
std::string temp = std::format("{}", value);
|
||||||
temp << std::format("{}", value);
|
setSize(temp.length());
|
||||||
std::string temp2 = temp.str();
|
memcpy(this->data, (char *)temp.data(), temp.length());
|
||||||
setSize(temp2.length());
|
|
||||||
memcpy(this->data, (char *)temp2.data(), temp2.length());
|
|
||||||
cursor = this->data;
|
cursor = this->data;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
g++ -g -o zstring_test zstring_test.cpp -I.. -L.. -lCoreUtils
|
g++ -g -std=c++20 -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 mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils
|
||||||
#g++ -o jstring_test jstring_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