Boost logo

Boost Users :

From: Becher, Jochen (jochen.becher_at_[hidden])
Date: 2008-05-29 02:31:30


Because I didn't understand the problem MSVC had with my source I wrote a little template:

template<typename T>
struct dump_type
{
    dump_type()
    {
        type_dumped;
    }
};

It does nothing then creating an error message (identifier type_dumped not defined). The error message contains type T also. I used this to see how some type are defined. Using it with

dump_type<std::map<std::string,std:string>::const_iterator::reference> x;

prints:

T=const std::pair<const std::string,std::string>

There is no reference symbol in this dumped type expression. Because of that I simply didn't recognize that ::reference is a reference type.

Regards, Jochen

-----Urspruengliche Nachricht-----
Von: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] Im Auftrag von Daniel Kruegler
Gesendet: Donnerstag, 29. Mai 2008 08:20
An: boost-users_at_[hidden]
Betreff: Re: [Boost-users] boost::is_const does not recognize constant type

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 Kruegler

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Stryker Leibinger GmbH & Co. KG
Sitz: Freiburg - Handelsregister: AG Freiburg HRA 4375
Komplementaerin: Stryker Beteiligungs GmbH
Geschaeftsfuehrer: Dr. Heinrich W. Dreyer, Klaus Welte
Sitz: Freiburg - Handelsregister: AG Freiburg HRB 5441
Bankverbindung: Bank of America N.A. Frankfurt 17 362 010 - BLZ 500 109 00, IBAN: DE04 5001 0900 0017 3620 10

 

Diese Nachricht und etwaige Dateianhaenge sind vertrauliche Informationen, die besonderen Geheimhaltungsvereinbarungen oder -vorschriften unterliegen koennen. Falls Sie nicht der beabsichtigte Empfaenger der Nachricht sind, werden Sie gebeten, den Absender telefonisch oder durch E-Mail zu unterrichten und die Nachricht und etwaige Dateianhaenge vollstaendig und endgueltig zu loeschen. Die Nachricht und ihr Inhalt duerfen in diesem Fall nicht kopiert, ausgedruckt oder weitergeleitet werden.

This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please telephone or e-mail the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.


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