Return a set of tokens instead of a vector
This commit is contained in:
parent
c51f7bca4c
commit
02454f5f7a
|
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue