Change struct to a function
No reason for the visitor to be a struct.
Change-Id: If63415b52d52a23ec24733a4c3268547d8fbdbef
diff --git a/src/ast_handlers.hpp b/src/ast_handlers.hpp
index 540d7e2..5b5a152 100644
--- a/src/ast_handlers.hpp
+++ b/src/ast_handlers.hpp
@@ -409,13 +409,11 @@
}
};
-struct commandNamesVisitor {
- template <typename T>
- std::string operator()(boost::type<T>)
- {
- return T::name;
- }
-};
+template <typename T>
+std::string commandNamesVisitor (boost::type<T>)
+{
+ return T::name;
+}
struct createCommandSuggestions_class {
template <typename T, typename Iterator, typename Context>
@@ -426,7 +424,7 @@
parserContext.m_suggestions.clear();
boost::mpl::for_each<CommandTypes, boost::type<boost::mpl::_>>([&parserContext](auto cmd) {
- parserContext.m_suggestions.insert({commandNamesVisitor()(cmd), " "});
+ parserContext.m_suggestions.insert({commandNamesVisitor(cmd), " "});
});
}
};
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 02d6666..253a16a 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -74,7 +74,7 @@
command_names_table()
{
boost::mpl::for_each<CommandTypes, boost::type<boost::mpl::_>>([this](auto cmd) {
- add(commandNamesVisitor()(cmd), decltype(help_::m_cmd)(cmd));
+ add(commandNamesVisitor(cmd), decltype(help_::m_cmd)(cmd));
});
}
} const command_names;