Re: pointers to functions
Carlos Moreno wrote:
kanze wrote:
Apparently, your compiler's <iostream> is deciding to make
use of the STL function objects, and it is importing minus
in the namespace std, causing ambiguity.
I'm not so sure about that. His error message didn't say
anything about any ambiguity, or refer to a problem with a
template in anyway.
Actually, g++ does say "minus is ambiguous" (I ran it at
some point after the thread had taken off, and got exactly
that message).
Really. It's certainly a possibility. I was basing myself on
what he reported as error messages. He didn't quote exactly,
so he may have only mentionned part of it, but his statements
seem to make it clear that his minus was being correctly found
(and correctly considered a function). (The second error
message he mentionned, about minus not being declared, is
presumably a knock-on -- because of the error in the definition
of minus, the compiler ignored the entire definition.)
I don't think that there are many ways you
can use std::minus without following it with a <.
That's a good point -- I didn't think of that when getting
the above error message.
Well, I don't think it would affect the ambiguity; the presence
or absence of a '<' doesn't affect name lookup. On the other
hand, if the name lookup finds a template, and the next symbol
isn't a '<', you're likely to get some additional error
messages. More importantly, if name lookup finds a template,
the interpretation of the following '<' is different.
--
James Kanze GABI Software
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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]