What is the difference between basic_istream and istream?
2 answers
basic_istream is a template:
template <class charT, class traits = char_traits<charT>> class basic_istream; istream and wistream are aliases (*) of this template, for cases when charT is char and wchar_t respectively.
using istream = basic_istream<char>; using wistream = basic_istream<wchar_t>; *) The term “specialization” or “instantiation” could be used here, but with reference to using and typedef , these terms cause much controversy (in particular, we do not know whether basic_istream<char> implemented as explicit specialization or not).
- @ixSci corrected the answer. - Abyx
|
There is no difference between them, because istream is nothing more than basic_istream<char> .
- Well, I would still say that one is a special case of the second. - VladD
- @VladD, as far as I remember, there is no separate specialization there, so it’s inappropriate to speak about a particular case, as it seems to me. This is a simple instantiation. - ixSci
- Well yes. I
istreamisbasic_stream<char>, that is, it is a specific template instantiation. Andbasic_istreamis just the template itself. A special case is not in the sense of inheritance. - VladD
|