From boost Wed Aug 09 07:55:31 2006 From: Marc Mutz Date: Wed, 09 Aug 2006 07:55:31 +0000 To: boost Subject: [boost] [variant] apply_visitor to rvalue variant Message-Id: <200608090955.33204.marc () klaralvdalens-datakonsult ! se> X-MARC-Message: https://marc.info/?l=boost&m=118835820867397 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_1TZ2EphVy8AJshI" --Boundary-00=_1TZ2EphVy8AJshI Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, can anyone here shed some light on this? Thanks, Marc =2D-=20 Marc Mutz -- marc@klaralvdalens-datakonsult.se, mutz@kde.org Klar=E4lvdalens Datakonsult AB, Platform-independent software solutions --Boundary-00=_1TZ2EphVy8AJshI Content-Type: message/rfc822; name="forwarded message" Content-Transfer-Encoding: 7bit Content-Description: Marc Mutz : [Boost-users] [variant] apply_visitor to rvalue variant Content-Disposition: inline Return-Path: Received: from localhost (localhost [127.0.0.1]) by auriga.hrhansen.dk (Cyrus v2.2.12) with LMTPA; Mon, 10 Jul 2006 11:32:20 +0200 X-Sieve: CMU Sieve 2.2 Received: from localhost (localhost [127.0.0.1]) by auriga.hrhansen.dk (Postfix) with ESMTP id BDB739D171 for ; Mon, 10 Jul 2006 11:32:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by auriga.hrhansen.dk (Postfix) with ESMTP id 568839D2A7 for ; Mon, 10 Jul 2006 11:32:19 +0200 (CEST) Received: from auriga.hrhansen.dk ([127.0.0.1]) by localhost (auriga [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29754-10 for ; Mon, 10 Jul 2006 11:32:16 +0200 (CEST) Received: from wowbagger.osl.iu.edu (wowbagger.osl.iu.edu [129.79.245.252]) by auriga.hrhansen.dk (Postfix) with ESMTP id A11329CE16 for ; Mon, 10 Jul 2006 11:32:15 +0200 (CEST) Received: from wowbagger.osl.iu.edu (localhost [127.0.0.1]) by wowbagger.osl.iu.edu (Postfix) with ESMTP id D09C0105520; Mon, 10 Jul 2006 05:20:30 -0400 (EDT) X-Original-To: boost-users@lists.boost.org Delivered-To: boost-users@lists.boost.org Received: from auriga.hrhansen.dk (hrhansen.dk [80.63.196.222]) by wowbagger.osl.iu.edu (Postfix) with ESMTP id 076E31054FB for ; Mon, 10 Jul 2006 05:20:26 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by auriga.hrhansen.dk (Postfix) with ESMTP id 5A18C9D3B4 for ; Mon, 10 Jul 2006 11:32:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by auriga.hrhansen.dk (Postfix) with ESMTP id 074C19D2A7 for ; Mon, 10 Jul 2006 11:32:07 +0200 (CEST) Received: from auriga.hrhansen.dk ([127.0.0.1]) by localhost (auriga [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29841-05 for ; Mon, 10 Jul 2006 11:32:01 +0200 (CEST) Received: from vimes (klaralvdalens-datakonsult.de [81.169.166.209]) by auriga.hrhansen.dk (Postfix) with ESMTP id 391679CE16 for ; Mon, 10 Jul 2006 11:32:01 +0200 (CEST) From: Marc Mutz To: boost-users@lists.boost.org Date: Mon, 10 Jul 2006 11:19:54 +0200 User-Agent: KMail/1.7 (proko2 2.0.4) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_7uhsEbJSnweafDE" Message-Id: <200607101119.55677.marc@klaralvdalens-datakonsult.se> X-Virus-Scanned: by amavisd-new at kdab.net Subject: [Boost-users] [variant] apply_visitor to rvalue variant X-BeenThere: boost-users@lists.boost.org X-Mailman-Version: 2.1.6 Precedence: list Reply-To: boost-users@lists.boost.org List-Id: Boost Users mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: boost-users-bounces@lists.boost.org Errors-To: boost-users-bounces@lists.boost.org X-Virus-Scanned: by amavisd-new at kdab.net X-Kolab-Scheduling-Message: FALSE X-Length: 5280 X-UID: 3543 --Boundary-00=_7uhsEbJSnweafDE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, My gcc 4.0 doesn't let me call apply_visitor on an rvalue variant. This is = due=20 to the Variant argument being a non-const reference, I guess. Is this a=20 deliberate design decision (if so, the rationale should be documented), an= =20 oversight (in that case, it should be fixed), or a compiler bug (highly=20 unlikely, since all of gcc 3.2 through 4.1 would then have it). Testcase (=3D=3D usecase) attached. Thanks, Marc =2D-=20 Marc Mutz -- marc@klaralvdalens-datakonsult.se, mutz@kde.org Klar=E4lvdalens Datakonsult AB, Platform-independent software solutions --Boundary-00=_7uhsEbJSnweafDE Content-Type: text/x-c++src; charset="iso-8859-1"; name="test_variant_rvalue_visitation.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test_variant_rvalue_visitation.cpp" #include #include #include typedef boost::variant Variant; Variant foo(); struct ToString : boost::static_visitor { template std::string operator()( const T & t ) const { return boost::lexical_cast( t ); } }; int main() { const std::string str = apply_visitor( ToString(), foo() ); } --Boundary-00=_7uhsEbJSnweafDE Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users --Boundary-00=_7uhsEbJSnweafDE-- --Boundary-00=_1TZ2EphVy8AJshI--