Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 79367 invoked from network); 20 May 2008 01:15:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 May 2008 01:15:51 -0000 Received: (qmail 87068 invoked by uid 500); 20 May 2008 01:15:53 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 87049 invoked by uid 500); 20 May 2008 01:15:53 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 87038 invoked by uid 99); 20 May 2008 01:15:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 May 2008 18:15:53 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2008 01:15:07 +0000 Received: from exchmail01.Blue.Roguewave.Com (exchmail01.blue.roguewave.com [10.22.129.22]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m4K1FKsx022728 for ; Tue, 20 May 2008 01:15:21 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C8BA16.F82594CF" Subject: FW: std::is_same and std::type_info::operator== equivalent? Date: Mon, 19 May 2008 19:15:19 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: std::is_same and std::type_info::operator== equivalent? Thread-Index: Aci59WOM0gLqOJJoROOJdPNwI2ooqAAGNmvI References: From: "Travis Vitek" To: "Eric Lemings" , Cc: "Martin Sebor" X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C8BA16.F82594CF Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Eric Lemings wrote: > >The code >=20 >typeid(T1) =3D=3D typeid(T2) >=20 >is the runtime equivalent of >=20 >std::is_same::value >=20 >correct? >=20 According to 5.2.8/4 of the current draft... When typeid is applied to a type-id, the result refers to a std::type_info object representing the type of the type-id. If the type of the type-id is a reference to a possibly cv- qualified type, the result of the typeid expression refers to a std::type_info object representing the cv-unqualified referenced type. If the type of the type-id is a class type or a reference to a class type, the class shall be completely-defined. >From what I read, is_same doesn't require the two types to be fully = defined and it doesn't strip cv-qualifiers when comparing types. So the = following testcase would fail... #include #include #include template bool is_same_type() { return (typeid(T) =3D=3D typeid(U)); } class C; int main () { #define TEST(T,U) assert ((std::is_same::value =3D=3D = is_same_type())); TEST (int&, const int&); // fails statement 2 TEST (C, C); // fails statement 3 return 0; } >Brad. =20 ------_=_NextPart_001_01C8BA16.F82594CF--