Home » U++ TheIDE » U++ TheIDE: Layout (Forms) Designer » operator ambiguous
operator ambiguous [message #29793] |
Wed, 17 November 2010 12:32 |
o_wild
Messages: 28 Registered: December 2008 Location: Urmqi
|
Promising Member |
|
|
The expression
~edit_D - ~edit_ddd
will cause an error:
ambiguous overload for 'operator-' in 'Upp::Ctrl::operator~() const() - Upp::Ctrl::operator~()
const()'
candidates are: operator-(double, double) <built-in>
operator-(double, int) <built-in>
operator-(double, Upp::int64) <built-in>
...
(edit_D is EditDouble and edit_ddd is EditInt.)
Even I replace the ~ to .GetData(), error remains.
|
|
|
Re: operator ambiguous [message #29794 is a reply to message #29793] |
Wed, 17 November 2010 13:40 |
|
The problem is that GetData() (and ~ as well, as it is just shorthand for the same) return Value, which can store one of many different types. If you store the value to variable (e.g. int i= ~editint) then it is casted automatically. But if you want to use value in some more complex statements, such as the one you encountered, you have to tell the compiler what type is in the Value explicitly. That can be done for example like this: (double)~edit_D - (double)~edit_ddd.
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Fri Sep 20 09:23:36 CEST 2024
Total time taken to generate the page: 0.04046 seconds
|