Return a set of tokens instead of a vector

This commit is contained in:
Thomas Avé 2017-01-20 21:38:43 +01:00
parent c51f7bca4c
commit 02454f5f7a
2 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@
#include <istream>
#include <vector>
#include <set>
#include <string>
namespace lxs {
@ -29,7 +30,7 @@ namespace input {
*
* @return the list of tokens
*/
static std::vector<std::string> getTokens(std::istream& is);
static std::set<std::string> getTokens(std::istream& is);
};
/**

View File

@ -14,11 +14,11 @@ namespace input {
return m_what.c_str();
}
std::vector<std::string> InputParser::getTokens(std::istream& is) {
std::set<std::string> InputParser::getTokens(std::istream& is) {
auto lines = parseInput(is);
std::vector<std::string> tokens;
std::set<std::string> tokens;
for(auto line: lines) {
tokens.push_back(line.second.first);
tokens.insert(line.second.first);
std::cout << line.second.first << std::endl;
}
return tokens;