Re: Implementation of my first template class
29 Sep
2003
29 Sep
'03
3:58 a.m.
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;
7662
Age (days ago)
7662
Last active (days ago)
0 comments
1 participants
participants (1)
-
Zenaan Harkness