Make getId() a constexpr function and use arrow syntax to call it in Target.hpp instead of dereferencing a pointer
This commit is contained in:
parent
52474d6521
commit
d6642f9ae5
|
@ -15,7 +15,7 @@ using namespace std;
|
|||
|
||||
#define IS(X) template<typename T, typename std::enable_if<std::is_base_of<X, T>::value>::type* = nullptr>
|
||||
struct ParseComponent {
|
||||
[[nodiscard]] const type_info& getId() const { return typeid(*this); }
|
||||
[[nodiscard]] constexpr const type_info& getId() const { return typeid(*this); }
|
||||
virtual ~ParseComponent() = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
string transpileWithTree(const ParseTree& tree) {
|
||||
output.str(string());
|
||||
for (const unique_ptr<ParseComponent>& component: tree) {
|
||||
const type_info& id = (*component).getId();
|
||||
const type_info& id = component->getId();
|
||||
with(StandardComponents::Define);
|
||||
with(StandardComponents::types::String);
|
||||
with(StandardComponents::Reference);
|
||||
|
|
Loading…
Reference in New Issue