Remove redundant optional usage in Target.hpp
This commit is contained in:
parent
1082bcf58f
commit
5580b8f204
|
@ -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__
|
||||
|
|
Loading…
Reference in New Issue