トークン分割(改版とまとめ)
↑ コメントによりますと追いつけない領域だそうな。
ならばいっそバックミラーの彼方に引き離してみゆ。
以下のメソッドを追加:
typedef std::input_iterator_tag iterator_category;
typedef string_type value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
tokenizer& begin(const string_type& source)
{ start(source); next(); return *this; }
tokenizer& begin() { reset(); next(); return *this; }
tokenizer end()
{ tokenizer t(dlm_); t.start(src_);
t.rng_.first = string_type::npos; return t; }
friend bool operator==(const tokenizer& x, const tokenizer& y)
{ return x.rng_.first == string_type::npos &&
x.rng_.first == string_type::npos; }
friend bool operator!=(const tokenizer& x, const tokenizer& y)
{ return !(x == y); }
tokenizer& operator++() { next(); return *this; }
string_type operator*() { return token(); }
----- おためし -----
#include <SilverBouquet/tokenizer.h>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
int main() {
SilverBouquet::tokenizer<std::string> tk(",.");
std::vector<std::string> v;
std::copy(tk.begin("Hello,world."), tk.end(), std::back_inserter(v));
// only for Visual C++ 8.0 or later
for each ( std::string token in v ) {
std::cout << token << std::endl;
}
}