Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 5915 invoked from network); 17 Jul 2008 14:54:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jul 2008 14:54:20 -0000 Received: (qmail 43954 invoked by uid 500); 17 Jul 2008 14:54:20 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 43936 invoked by uid 500); 17 Jul 2008 14:54:20 -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 43924 invoked by uid 99); 17 Jul 2008 14:54:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jul 2008 07:54:20 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=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; Thu, 17 Jul 2008 14:53:27 +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 m6HEpnJP012989 for ; Thu, 17 Jul 2008 14:51:49 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: structure of tuple tests ([Fwd: Re: svn commit: r675044 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h include/tuple tests/utilities/20.tuple.cnstr.cpp tests/utilities/20.tuple.creation.cpp tests/utilities/20.tuple.h tests/utilities/20.tuple.helpers Date: Thu, 17 Jul 2008 08:51:41 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: structure of tuple tests ([Fwd: Re: svn commit: r675044 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h include/tuple tests/utilities/20.tuple.cnstr.cpp tests/utilities/20.tuple.creation.cpp tests/utilities/20.tuple.h tests/utilities/20.tuple.helpers Thread-Index: AcjnzFV/ZJcFAgF9QTm9SRaRdZaKtgAT8HdA References: <4877831C.4060009@roguewave.com> <4877AF00.5000805@roguewave.com> <487ED543.3060001@roguewave.com> From: "Eric Lemings" To: X-Virus-Checked: Checked by ClamAV on apache.org =20 > -----Original Message----- > From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor > Sent: Wednesday, July 16, 2008 11:15 PM > To: dev@stdcxx.apache.org > Subject: Re: structure of tuple tests ([Fwd: Re: svn commit:=20 > r675044 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h=20 > include/tuple tests/utilities/20.tuple.cnstr.cpp=20 > tests/utilities/20.tuple.creation.cpp=20 > tests/utilities/20.tuple.h tests/utilities/20.tuple.helpers >=20 > Btw., here's a prototype of a utility for pretty printing of > tuple types. It might come in handy as a generic implementation > of type_name() for tuples, as a replacement for the handful of > hardwired tuple types we have there. >=20 >=20 > #include > #include >=20 > template const char* type_name () { return "???"; } Should be left undefined so that you get a compile error and can add the unreferenced type_name() specialization as appropriate. Also, I'd prefer a compile-time facility for converting types to strings. There's really no need for using a function, is there? > template <> const char* type_name() { return "char"; } > template <> const char* type_name() { return "short"; } > template <> const char* type_name() { return "int"; } > // ... >=20 > template > struct Name; >=20 > template > struct Name { > static void append (char* buf) { > std::strcat (buf, type_name()); > } > }; >=20 > template <> > struct Name<> { > static void append (char*) { } > }; >=20 > template > struct Name { > static void append (char *buf) { > std::strcat (buf, type_name()); > std::strcat (buf, ", "); >=20 > Name::append (buf); > } > }; >=20 > template > char* name (std::tuple*) > { > static char buf [256]; >=20 > std::strcpy (buf, "tuple<"); >=20 > Name::append (buf); >=20 > std::strcat (buf, ">"); >=20 > return buf; > } I started writing a compile-time version of this but it started to take too long to write. Now that I have some extra time though... :) Brad.