Making the stream a template parameter is useless, it has to be an ostream in any case - unless you were planning supporting other classes that have the << operator overloaded, but those are likely to have different semantics anyways.
Is there a real need for stm.widen() if operator<< (specifically, template< class CharT, class Traits> basic_ostream<CharT,Traits>& operator<<( std::basic_ostream<CharT,Traits>& os, char ch );) already calls it?
> Is there a real need for stm.widen() if
> operator<< (specifically, template< class CharT, class Traits> basic_ostream<CharT,Traits>& operator<<( std::basic_ostream<CharT,Traits>& os, char ch );)
> already calls it?
No, there is no real need - it would get called anyway. widen() is only required if one is using put().
What do you mean "doesn't work"? Does it not compile? Does it not input the values correctly? Does it make your computer start to smoke? Does yours eyes explodes whens yous runs its?
it doesn't compile, it says:
In function `STREAM& operator>>(STREAM&, const std::pair<F, S>&) [with STREAM = std::istream, F = int, S = int]':
instantiated from here
no match for 'operator>>' in 'stm >> ((const int*)pair)'
candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>&(*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
(...)
a lot more candidates