leverage std::make_unique & std::make_shared

- Simpler code & more efficient because control block can be allocated
  with object.
This commit is contained in:
Eduardo Arias
2024-05-05 13:06:50 -03:00
parent 9e02b3cf01
commit c6c06c4f33
5 changed files with 12 additions and 12 deletions

View File

@@ -105,11 +105,11 @@ class Action {
}
if (pos == std::string::npos) {
m_name = std::shared_ptr<std::string>(new std::string(data));
m_name = std::make_shared<std::string>(data);
return;
}
m_name = std::shared_ptr<std::string>(new std::string(data, 0, pos));
m_name = std::make_shared<std::string>(data, 0, pos);
m_parser_payload = std::string(data, pos + 1, data.length());
if (m_parser_payload.at(0) == '\'' && m_parser_payload.size() > 2) {