Boost logo

Boost Users :

From: Daniel Krügler (dsp_at_[hidden])
Date: 2008-05-29 02:19:41


Becher, Jochen wrote:
> thank you, you are right, remove_reference fixes the problem. I do not understand why MSVC print the reference type without the reference symbol (I checked this twice) but internally it seems to be a reference type (and that is what you expect for typedef ...::reference).

I don't know, what you mean with "MSVC print the reference type". Do you
mean the debugger view, the result of typeid(your_type).name()?

The standard clearly says that typeid(some_type) == typeid(some_type&),
see [expr.typeid]/4:

"[..] If the type of the type-id is a reference type, the result of the
typeid expression refers to a type_info object representing the
referenced type [..] "

So, it's more than reasonable that any debugger view will use a similar
logic.

>>It should evaluate to the true type because ...::reference is
>>
>>const std::pair<const std::string,std::string>
>
>
> Nope, wouldn't that be:
>
> const std::pair<const std::string,std::string>&
>
> which is a reference type and can be neither const nor volatile qualified
> (the const qualifier in the above refers to the thing being referenced not
> the reference itself). If you feed it through remove_reference before
> passing to is_const then you should get true as the result.

IMO John meant the reference type, otherwise his message
would not make much sense.

Greetings from Bremen,

Daniel Krügler


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net