Boost logo

Boost Users :

From: Zenaan Harkness (zen_at_[hidden])
Date: 2003-09-28 22:58:42


Take 3:

/**
 * A class providing a combination of an input stream
 * and an input iterator.
 * I use for convenience when processing a part-ascii,
 * part-binary stream.
 */
template<typename charT, typename traits = std::char_traits<charT> >
class basic_istringtraverser
 : public std::basic_istringstream<charT, traits> {
public:
  basic_istringtraverser(std::basic_string<charT> s)
    : std::basic_istringstream<charT, traits>(s) {}
  charT operator*() {return (charT)(rdbuf()->sgetc());}
  basic_istringtraverser& operator++() {
    rdbuf()->sbumpc(); return *this;
  }
};

/** Specialization for char type. */
typedef basic_istringtraverser<char> istringtraverser;


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net