James Kanze
10/20/2008 7:03:00 PM
On Oct 20, 4:44 pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
> Ares Lagae wrote:
> > On Oct 20, 4:05 pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
> > Thank you for your quick reply.
> >> Your argument is declared non-const here, but you pass a const ref.
> > I have added "const" but that did not change anything.
> >> Also, this is a non-deducible context.
> > So it seems. The call "operator<< <char, std::char_traits<char>,
> > int>(std::cout, b)" works.
> > Can you explain Why?
> Explain why what? Why it's a non-deducible context? I don't
> know. Here, the boilerplate answer is "because the Standard
> says so", but why it's so in the Standard... There are
> *probably* cases in which the compiler would have hard time
> deciding and the Standard Committee did not want to impose the
> "undue hardship" on the compiler implementors. But your guess
> is probably as good as mine. Try looking in the archives for
> "non-deducible context".
I wasn't present during the discussions concerning this
particular point, but I can make some good guesses as to why it
isn't deducible. In the general case, the only way to deduce it
would be to try every possible instantiation, to see if one
matches---until you've instantiated Outer<T>, you can't know
what Outer<T>::Inner is. Given that the number of possible
instantiations is infinite, the committee probably felt that
this was asking a little too much of the implementors.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34