Listing 5: The Kleene star class implementation
// Copyright (c) 2001, Joel de Guzman and Dan Nuffer // Permission is granted to use this code without restriction as // long as this copyright notice appears in all source files. template <typename S> struct kleene_star : public unary<S> , public parser<kleene_star<S> > { kleene_star(S const& a) : unary<S>(a) {} template <typename IteratorT> match parse(IteratorT& first, IteratorT const& last) const { match hit(0); while (match next = this->subject().parse(first, last)) hit += next; return hit; } };