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

This commit is contained in:
Igor [hyperxor]
2022-06-01 02:05:22 +03:00
committed by GitHub
parent 190ad502b5
commit c73ee34704
4 changed files with 4 additions and 4 deletions

View File

@@ -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()) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;