From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-05-09 14:48:17


Gerhard Wesp wrote:
> On Tue, May 09, 2006 at 07:06:56PM +0200, Tobias Schwinger wrote:
>
>> rational c = convert(a) / b
>
>
> Do you already have possible overloads and return types for convert() in
> mind?
>

Sure: 'convert' returns an expression, just like any other operator. That expression will be something like a reference wrapper for the argument.

When the full compound expression is evaluated the convert expression protects its component expression from result type propagation.

Best case, it's all it does -- the evaluation machinery can view the result of the evaluation as a value of the expected domain.

For narrowing conversions and for builtins the appropriate algorithm has is invoked to perform the actual conversion.

Regards,

Tobias