Remove redundant optional usage in Target.hpp
This commit is contained in:
parent
a16e4ef4b2
commit
099b4e4136
|
@ -68,7 +68,7 @@ protected:
|
||||||
typedef function<void (const ParseTree& parsedTree, unsigned int& index)> task;
|
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_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)
|
#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;
|
virtual unordered_task_map getTaskMap() = 0;
|
||||||
public:
|
public:
|
||||||
const unordered_task_map& getTaskMapInstance() {
|
const unordered_task_map& getTaskMapInstance() {
|
||||||
|
@ -93,8 +93,8 @@ public:
|
||||||
const unique_ptr<ParseComponent>& component = tree[i];
|
const unique_ptr<ParseComponent>& component = tree[i];
|
||||||
const type_info& id = component->getId();
|
const type_info& id = component->getId();
|
||||||
try {
|
try {
|
||||||
const optional<task>& currentTask = taskMap.at(id);
|
const task& currentTask = taskMap.at(id);
|
||||||
if (currentTask.has_value()) currentTask.value()(tree, i);
|
currentTask(tree, i);
|
||||||
} catch (const out_of_range&) {
|
} catch (const out_of_range&) {
|
||||||
throw Yerbacon::Exception(string(
|
throw Yerbacon::Exception(string(
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
|
Loading…
Reference in New Issue