Skip to content

Commit 03bd6bb

Browse files
author
childcity
committed
delete useless clear() in ConsoleString
1 parent 694ac60 commit 03bd6bb

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

CppConsoleTable.hpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,17 @@ namespace samilton {
7575
}
7676

7777
ConsoleString &operator=(const std::string &val) {
78-
clear();
7978
_parseString(val);
8079
return *this;
8180
}
8281

83-
ConsoleString &operator=(const char *val) {
84-
clear();
85-
_parseString(std::string(val));
86-
return *this;
87-
}
88-
8982
ConsoleString &operator=(const char &val) {
90-
clear();
9183
_parseString(std::string(1, val));
9284
return *this;
9385
}
9486

9587
template<class T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
9688
ConsoleString &operator=(const T &val) {
97-
clear();
9889
_str.push_back(std::to_string(val));
9990
return *this;
10091
}
@@ -140,6 +131,7 @@ namespace samilton {
140131
friend std::ostream &operator<<(std::ostream &stream, ConsoleTable &table);
141132

142133
void _parseString(const std::string &val) {
134+
clear();
143135
auto tmpIterator = val.begin();
144136
for (auto i = val.begin(); i < val.end(); ++i) {
145137
if (*i == '\n') {

0 commit comments

Comments
 (0)