Add a return type to the ParseTree "<<" operator.

This commit is contained in:
Username404 2021-08-07 13:33:13 +02:00
parent 2a5df0bb32
commit c23d88e0eb
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 1 deletions

View File

@ -22,7 +22,8 @@ public:
subComponents.push_back(component); subComponents.push_back(component);
}; void addAll(const vector<ParseComponent>& components) const { }; void addAll(const vector<ParseComponent>& components) const {
for (const auto& comp: components) add(comp); for (const auto& comp: components) add(comp);
}; void operator<<(const ParseComponent& component) const { add(component); } }
const ParseTree& operator<<(const ParseComponent& component) const { add(component); return *this; }
explicit ParseTree(const ParseComponent& element): subComponents() { add(element); } explicit ParseTree(const ParseComponent& element): subComponents() { add(element); }
ParseTree(const initializer_list<ParseComponent>& elements): subComponents() { addAll(elements); } ParseTree(const initializer_list<ParseComponent>& elements): subComponents() { addAll(elements); }
ParseTree(): subComponents() {}; ParseTree(): subComponents() {};