Listing 5: Complete stream class

template
<
    class charT,
    class traits = std::char_traits<charT>
>
class TCPGenericStream :
    private TCPStreamBuffer<charT, traits>,
    public std::basic_iostream<charT, traits>
{
public:
    explicit TCPGenericStream(TCPSocketWrapper &sock,
                              bool takeowner = false)
        : TCPStreamBuffer<charT, traits>(sock, takeowner),
        std::basic_iostream<charT, traits>(this)
    {
    }

private:
    // copy not provided
    TCPGenericStream(const TCPGenericStream&);
    TCPGenericStream& operator=(const TCPGenericStream&);
};
— End of Listing —