Add contains method to ValueTokenizer

This commit is contained in:
Richard Berger
2020-06-09 12:11:53 -04:00
parent e641671da9
commit c1f6c004ca
3 changed files with 17 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "tokenizer.h"
#include "utils.h"
#include <algorithm>
using namespace LAMMPS_NS;
@ -84,6 +85,10 @@ bool ValueTokenizer::has_next() const {
return current != tokens.cend();
}
bool ValueTokenizer::contains(const std::string & value) const {
return std::find(tokens.cbegin(), tokens.cend(), value) != tokens.cend();
}
std::string ValueTokenizer::next_string() {
if (has_next()) {
std::string value = *current;