Unverified Commit c73ee347 by Igor [hyperxor] Committed by GitHub

Small perfomance optimization in Directives and Tag methods (#1112)

parent 190ad502
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace YAML { namespace YAML {
Directives::Directives() : version{true, 1, 2}, tags{} {} Directives::Directives() : version{true, 1, 2}, tags{} {}
const std::string Directives::TranslateTagHandle( std::string Directives::TranslateTagHandle(
const std::string& handle) const { const std::string& handle) const {
auto it = tags.find(handle); auto it = tags.find(handle);
if (it == tags.end()) { if (it == tags.end()) {
......
...@@ -19,7 +19,7 @@ struct Version { ...@@ -19,7 +19,7 @@ struct Version {
struct Directives { struct Directives {
Directives(); Directives();
const std::string TranslateTagHandle(const std::string& handle) const; std::string TranslateTagHandle(const std::string& handle) const;
Version version; Version version;
std::map<std::string, std::string> tags; std::map<std::string, std::string> tags;
......
...@@ -29,7 +29,7 @@ Tag::Tag(const Token& token) ...@@ -29,7 +29,7 @@ Tag::Tag(const Token& token)
} }
} }
const std::string Tag::Translate(const Directives& directives) { std::string Tag::Translate(const Directives& directives) {
switch (type) { switch (type) {
case VERBATIM: case VERBATIM:
return value; return value;
......
...@@ -23,7 +23,7 @@ struct Tag { ...@@ -23,7 +23,7 @@ struct Tag {
}; };
Tag(const Token& token); Tag(const Token& token);
const std::string Translate(const Directives& directives); std::string Translate(const Directives& directives);
TYPE type; TYPE type;
std::string handle, value; std::string handle, value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment