Make Tokenizers movable

This commit is contained in:
Richard Berger
2020-06-04 16:23:46 -04:00
parent d9345a1652
commit 6c41c2f69d
2 changed files with 26 additions and 2 deletions

View File

@ -37,6 +37,12 @@ Tokenizer::Tokenizer(const std::string & str, const std::string & seperators) {
} while(end != std::string::npos);
}
Tokenizer::Tokenizer(const Tokenizer & rhs) : tokens(rhs.tokens) {
}
Tokenizer::Tokenizer(Tokenizer && rhs) : tokens(std::move(rhs.tokens)) {
}
Tokenizer::iterator Tokenizer::begin() {
return tokens.begin();
}
@ -66,6 +72,14 @@ ValueTokenizer::ValueTokenizer(const std::string & str, const std::string & sepe
current = tokens.begin();
}
ValueTokenizer::ValueTokenizer(const ValueTokenizer & rhs) : tokens(rhs.tokens) {
current = tokens.begin();
}
ValueTokenizer::ValueTokenizer(ValueTokenizer && rhs) : tokens(std::move(rhs.tokens)) {
current = tokens.begin();
}
bool ValueTokenizer::has_next() const {
return current != tokens.cend();
}