Remove redundant optional usage in Target.hpp

This commit is contained in:
Username404 2021-12-22 20:38:36 +01:00
parent a16e4ef4b2
commit 099b4e4136
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ protected:
typedef function<void (const ParseTree& parsedTree, unsigned int& index)> task;
#define make_task_base(type, captures, function_body) make_pair(type_index(typeid(type)), [captures](const ParseTree& parsedTree, unsigned int& index) { const type& parseComponent = pointerAs<type>(parsedTree[index]); function_body })
#define make_task(T, F) make_task_base(T, this, F)
typedef unordered_map<type_index, optional<task>> unordered_task_map;
typedef unordered_map<type_index, task> unordered_task_map;
virtual unordered_task_map getTaskMap() = 0;
public:
const unordered_task_map& getTaskMapInstance() {
@ -93,8 +93,8 @@ public:
const unique_ptr<ParseComponent>& component = tree[i];
const type_info& id = component->getId();
try {
const optional<task>& currentTask = taskMap.at(id);
if (currentTask.has_value()) currentTask.value()(tree, i);
const task& currentTask = taskMap.at(id);
currentTask(tree, i);
} catch (const out_of_range&) {
throw Yerbacon::Exception(string(
#ifndef __GNUC__