I am writing stratum streambuf
deriving from std::basic_streambuf
:
/// Basic Socket Buffer
template<
typename CharT_,
typename Traits_ = std::char_traits< CharT_ > >
class BasicSocketBuffer //BasicSocketStreamBuffer
: public std::basic_streambuf< CharT_, Traits_ >
{
...
virtual int_type
overflow(int_type __c = traits_type::eof());
...
Errors:
error: 'int_type' does not name a type
virtual int_type
^~~~~~~~
note: (perhaps 'typename std::basic_streambuf<_CharT, _Traits>::int_type' was intended)
Ha-ha. Compiler knows what I want, but won't do. Why?
Here are first lines of parent std class:
template<typename _CharT, typename _Traits>
class basic_streambuf
{
public:
//@{
/**
* These are standard types. They permit a standardized way of
* referring to names of (or names dependent on) the template
* parameters, which are specific to the implementation.
*/
typedef _CharT char_type;
typedef _Traits traits_type;
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
...
Workaround
Almost redeclare all used types once more in derived class;
class Derived : class Parent {
using Parent::int_type; // for non-templated
using typename Parent::char_type;
...
Do you know better way? C++11,14 are welcome.