Avoids string copy by working with pointers while resolving variables

This commit is contained in:
Felipe Zimmerle
2016-12-27 15:25:11 -03:00
parent 7834cf857b
commit a7f465cf3a
38 changed files with 179 additions and 94 deletions

View File

@@ -33,11 +33,20 @@ namespace collection {
class Variable {
public:
Variable(const std::string& key, const std::string& value) :
Variable(const std::string *key, const std::string *value) :
m_key(key),
m_value(value) { }
std::string m_key;
std::string m_value;
m_value(value),
m_dynamic_value(false) { }
~Variable() {
if (m_dynamic_value) {
delete m_value;
}
}
const std::string *m_key;
const std::string *m_value;
bool m_dynamic_value;
};
} // namespace collection