Operator overloading, well member function overload in general.
- From: dcw_yip@xxxxxxxxx
- Date: 4 Aug 2005 10:30:09 -0700
Hi:
So I'm trying to overload an operator. I have the following two
operators:
virtual T operator()(float x, float y, float z) const;
virtual T operator()(int x, int y, int z) const;
If I call it with foo(1.0f, 1.0f, 1.0f) I get an "overloads have
similar conversions" error. Even if I explicitly cast with
foo((float)1.0f, (float)1.0f, (float)1.0f) it's still ambiguous to VC++
..Net 2003. But if I declare it:
virtual T operator()(float &x, float &y, float &z) const;
It all works fine. As I understand C++, the first set of declarations
should work. Why would that be ambiguous? Am I wrong about this or is
it a bug in VC++?
David
.
- Follow-Ups:
- Re: Operator overloading, well member function overload in general.
- From: Victor Bazarov
- Re: Operator overloading, well member function overload in general.
- Prev by Date: Re: switching processors
- Next by Date: Re: Non-blocking console input
- Previous by thread: Non-blocking console input
- Next by thread: Re: Operator overloading, well member function overload in general.
- Index(es):
Relevant Pages
|