Re: std::ostringstream misunderstanding
On 23 Mrz., 11:01, "James Kanze" <james.ka...@gmail.com> wrote:
[..]
Today, were such desired, the
obvious solution would be to make operator<< a member template,
with no generic implementation, and to define specializations
for all of the various types (and of course, users could always
add specializations).
And regrettably this ansatz would not be allowed due to
an annoying oversight in the standard, consider:
template <typename T>
class Whatever {
template <typename U> void invoke(U);
};
template <typename T>
template <> // Ooops!
void Whatever::invoke<>(double){}
and replace Whatever<T> with std::basic_ostream<
class charT, class traits> and
template <typename T>
template <typename U>
void WhatEver<T>::invoke(T);
with
template <class charT, class traits>
template <typename U>
std::basic_ostream<charT,traits>&
std::basic_ostream<charT,traits>::operator<<(U);
and you end up at the problem discussed in my thread
"Specialization oddities" (http://tinyurl.com/232zya).
Unfortunately no-one has responded yet, so I claim
to name it "annoying oversight" until someone corrects
me. But non-correcting comments would also be fine ;-)
Greetings from Bremen,
Daniel
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]