H
highegg
Hello,
given the declarations
class A {};
template <class X, class T> void method (double u, T v);
template <class X> void method (double u, long v);
....
double u; long v;
Is the following call unambigous (w.r.t. C++ standard)?
method<A> (u, v);
For those wanting to see the true source (chances are that I omitted
some important circumstance),
this technique is used in new implementation of saturated integer
arithmetic for Octave
(http://hg.savannah.gnu.org/hgweb/octave/file/c1bada868690/liboctave/
oct-inttypes.h, *.cc)
for the octave_int_cmp_op::mop method.
gcc 4.x, Intel C++ and Visual C++ seem to accept the code, but a user
just reported Cygwin's gcc 3.4.4 failing. I just want to make user I
was not unintentionally some common extension. I inspected the C++
draft standard for the rules, and it seems that the answer is yes,
because the second declaration is a better match, but I'm still not
entirely sure.
thanks in advance,
Jaroslav Hajek
given the declarations
class A {};
template <class X, class T> void method (double u, T v);
template <class X> void method (double u, long v);
....
double u; long v;
Is the following call unambigous (w.r.t. C++ standard)?
method<A> (u, v);
For those wanting to see the true source (chances are that I omitted
some important circumstance),
this technique is used in new implementation of saturated integer
arithmetic for Octave
(http://hg.savannah.gnu.org/hgweb/octave/file/c1bada868690/liboctave/
oct-inttypes.h, *.cc)
for the octave_int_cmp_op::mop method.
gcc 4.x, Intel C++ and Visual C++ seem to accept the code, but a user
just reported Cygwin's gcc 3.4.4 failing. I just want to make user I
was not unintentionally some common extension. I inspected the C++
draft standard for the rules, and it seems that the answer is yes,
because the second declaration is a better match, but I'm still not
entirely sure.
thanks in advance,
Jaroslav Hajek