Optimize codes

Move node renaming after removing Emojis.
This commit is contained in:
Tindy X committed 2020-06-10 22:52:17 +08:00
1 parent 11ed400fc7
commit 80d16f3130
6 files changed
+34 -52

No files matched your search

+4 -9
View File
@@ -69,7 +69,7 @@ public:
template <typename T> void define(const T &value)
{
if(_M_VALUE == -1)
set(value);
*this = value;
}
bool get(const bool &def_value = false)
@@ -85,12 +85,6 @@ public:
return _M_VALUE;
}
bool set(const tribool &value)
{
_M_VALUE = value._M_VALUE;
return _M_VALUE;
}
bool set(const std::string &str)
{
switch(hash_(str))
@@ -185,11 +179,12 @@ template <typename T> static inline void eraseElements(T &target)
T().swap(target);
}
template <typename T> static inline T to_number(const std::string &str, T def_value)
template <typename T, typename U> static inline T to_number(const U &value, T def_value = T())
{
T retval = 0.0;
char c;
std::stringstream ss(str);
std::stringstream ss;
ss << value;
if(!(ss >> retval))
return def_value;
else if(ss >> c)