Index: boost/regex/v4/cpp_regex_traits.hpp =================================================================== --- boost/regex/v4/cpp_regex_traits.hpp (revision 85522) +++ boost/regex/v4/cpp_regex_traits.hpp (working copy) @@ -40,6 +40,7 @@ #include #endif +#include #include #include #include @@ -76,95 +77,10 @@ // template > -class parser_buf : public ::std::basic_streambuf -{ - typedef ::std::basic_streambuf base_type; - typedef typename base_type::int_type int_type; - typedef typename base_type::char_type char_type; - typedef typename base_type::pos_type pos_type; - typedef ::std::streamsize streamsize; - typedef typename base_type::off_type off_type; -public: - parser_buf() : base_type() { setbuf(0, 0); } - const charT* getnext() { return this->gptr(); } -protected: - std::basic_streambuf* setbuf(char_type* s, streamsize n); - typename parser_buf::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which); - typename parser_buf::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which); -private: - parser_buf& operator=(const parser_buf&); - parser_buf(const parser_buf&); -}; +class parser_buf + : public boost::detail::basic_pointerbuf > +{}; -template -std::basic_streambuf* -parser_buf::setbuf(char_type* s, streamsize n) -{ - this->setg(s, s, s + n); - return this; -} - -template -typename parser_buf::pos_type -parser_buf::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) -{ - typedef typename boost::int_t::least cast_type; - - if(which & ::std::ios_base::out) - return pos_type(off_type(-1)); - std::ptrdiff_t size = this->egptr() - this->eback(); - std::ptrdiff_t pos = this->gptr() - this->eback(); - charT* g = this->eback(); - switch(static_cast(way)) - { - case ::std::ios_base::beg: - if((off < 0) || (off > size)) - return pos_type(off_type(-1)); - else - this->setg(g, g + off, g + size); - break; - case ::std::ios_base::end: - if((off < 0) || (off > size)) - return pos_type(off_type(-1)); - else - this->setg(g, g + size - off, g + size); - break; - case ::std::ios_base::cur: - { - std::ptrdiff_t newpos = static_cast(pos + off); - if((newpos < 0) || (newpos > size)) - return pos_type(off_type(-1)); - else - this->setg(g, g + newpos, g + size); - break; - } - default: ; - } -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4244) -#endif - return static_cast(this->gptr() - this->eback()); -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif -} - -template -typename parser_buf::pos_type -parser_buf::seekpos(pos_type sp, ::std::ios_base::openmode which) -{ - if(which & ::std::ios_base::out) - return pos_type(off_type(-1)); - off_type size = static_cast(this->egptr() - this->eback()); - charT* g = this->eback(); - if(off_type(sp) <= size) - { - this->setg(g, g + off_type(sp), g + size); - } - return pos_type(off_type(-1)); -} - // // class cpp_regex_traits_base: // acts as a container for locale and the facets we are using.