Skip to content

Commit

Permalink
passing the initalizer list by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
AsherGlick committed Oct 4, 2023
1 parent b68be58 commit aede4e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions xml_converter/src/string_hierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool StringHierarchy::in_hierarchy(
// ambiguity between the vector and string overloads of the function.
////////////////////////////////////////////////////////////////////////////////
bool StringHierarchy::in_hierarchy(
const std::initializer_list<std::string> input) const {
const std::initializer_list<std::string> &input) const {
std::vector<std::string> vec;
vec.insert(vec.end(), input.begin(), input.end());
return this->in_hierarchy(vec);
Expand Down Expand Up @@ -95,7 +95,7 @@ const StringHierarchy *StringHierarchy::sub_hierarchy(
// prevent ambiguity between the vector and string overloads of the function.
////////////////////////////////////////////////////////////////////////////////
const StringHierarchy *StringHierarchy::sub_hierarchy(
const std::initializer_list<std::string> input) const {
const std::initializer_list<std::string> &input) const {
std::vector<std::string> vec;
vec.insert(vec.end(), input.begin(), input.end());
return this->sub_hierarchy(vec);
Expand Down
4 changes: 2 additions & 2 deletions xml_converter/src/string_hierarchy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class StringHierarchy {
const std::vector<std::string> &path) const;

bool in_hierarchy(
const std::initializer_list<std::string>) const;
const std::initializer_list<std::string> &input) const;

const StringHierarchy *sub_hierarchy(
const std::string &node) const;

const StringHierarchy *sub_hierarchy(
const std::initializer_list<std::string> input) const;
const std::initializer_list<std::string> &input) const;

const StringHierarchy *sub_hierarchy(
const std::vector<std::string> &path) const;
Expand Down

0 comments on commit aede4e4

Please sign in to comment.