From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18945 invoked by alias); 1 Aug 2005 11:29:21 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 18912 invoked by uid 22791); 1 Aug 2005 11:29:12 -0000 Received: from exprod6og1.obsmtp.com (HELO psmtp.com) (64.18.1.121) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Mon, 01 Aug 2005 11:29:12 +0000 Received: from source ([192.150.20.142]) by exprod6ob1.obsmtp.com ([64.18.5.12]) with SMTP; Mon, 01 Aug 2005 04:29:09 PDT Received: from inner-relay-3.eur.adobe.com (inner-relay-3b [10.128.4.236]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id j71BZGTK007386 for ; Mon, 1 Aug 2005 04:35:16 -0700 (PDT) Received: from iplan-mn (iplan-mn.corp.adobe.com [10.32.16.20]) by inner-relay-3.eur.adobe.com (8.12.10/8.12.9) with ESMTP id j71BT7iw029043 for ; Mon, 1 Aug 2005 04:29:08 -0700 (PDT) Received: from iplan-mn (localhost [127.0.0.1]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 2.02 (built Oct 21 2004)) with ESMTP id <0IKJ00G2FJWHOG@iplan-mn.corp.adobe.com> for gcc-help@gcc.gnu.org; Mon, 01 Aug 2005 06:29:05 -0500 (CDT) Received: from [10.32.16.88] (mn-eljay.corp.adobe.com [10.32.16.88]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 2.02 (built Oct 21 2004)) with ESMTP id <0IKJ00G2AJWHAD@iplan-mn.corp.adobe.com> for gcc-help@gcc.gnu.org; Mon, 01 Aug 2005 06:29:05 -0500 (CDT) Date: Mon, 01 Aug 2005 11:29:00 -0000 From: Eljay Love-Jensen Subject: Re: Is is possible to use the name of a variable in the constructor? In-reply-to: <200508010155.53152.gpiez@web.de> To: Gunther Piez , gcc-help@gcc.gnu.org Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/11.1.0.040913 X-SW-Source: 2005-08/txt/msg00007.txt.bz2 Hi Gunther, The easiest way to implement your desired functionality is to make "passing in the varname" a parameter, and by convention pass in the varname. ---------------------------------------------------------------- #include #include using std::cout; using std::endl; struct uniform { uniform(std::string const& prettyVarname) { cout << "A variable called \x1B[32m" << prettyVarname << "\x1B[0m was just instantiated (sp)" << endl; } }; void main() { uniform blah("blah"); } ---------------------------------------------------------------- HTH, --Eljay