Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-23 07:47:51


From: "John Maddock" <jm_at_[hidden]>
> >From Peter Dimov:
>
> >Nope, it says nothing AFAICS. A type cannot be convertible. Only values
> are.
> >And you cannot say "a value of type From is implicitly convertible to To
> >(4.0)" because you need to specify whether that value is an lvalue of
type
> >From or an rvalue of type From, and what do l- and r-values mean when
> >applied to strange (array, reference, function, abstract, etc) types.
>
> I refer you back to 4.0p3, which talks about expressions of type T, which
> are treated as lvalues if the type is a reference, otherwise as an rvalue.

Thanks.

I don't think that 4.0p3 explains everything, though. I doesn't talk about
expressions of type T. It talks about converting an expression e to type T;
it then explains that the result of that conversion is an lvalue when T
("To" in our case) is a reference type. It says that e is "used as an
lvalue" if and only if the initialization T t(e) would have used it as an
lvalue.

This still doesn't solve the "expression of type From" problem since an
expression can be either an lvalue or an rvalue, and there are no
expressions of reference types, only expressions that are lvalues. Of course
I'm not a core expert.

For example, is an expression of type int[4] convertible to int[4]? To int
(&) [4]? To int const [4]?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk