From patchwork Mon Oct 4 17:30:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 66713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9725CB70D4 for ; Tue, 5 Oct 2010 04:30:25 +1100 (EST) Received: (qmail 24794 invoked by alias); 4 Oct 2010 17:30:20 -0000 Received: (qmail 24765 invoked by uid 22791); 4 Oct 2010 17:30:19 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL, BAYES_05, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from vsmtp21.tin.it (HELO vsmtp21.tin.it) (212.216.176.109) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Oct 2010 17:30:14 +0000 Received: from [192.168.0.4] (79.36.30.77) by vsmtp21.tin.it (8.5.113) id 4BC86A490C0ABB78; Mon, 4 Oct 2010 19:30:11 +0200 Message-ID: <4CAA0F23.3020507@oracle.com> Date: Mon, 04 Oct 2010 19:30:11 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Minor function::swap clean up X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, I'm working on some C++0x bits of std::function and noticed this separable tweak. Tested x86_64-linux, committed. Paolo. //////////////////////// 2010-10-04 Paolo Carlini * include/std/functional (function<>::swap): Use std::swap. * include/tr1/functional (function<>::swap): Likewise. Index: include/std/functional =================================================================== --- include/std/functional (revision 164946) +++ include/std/functional (working copy) @@ -1940,15 +1940,9 @@ */ void swap(function& __x) { - _Any_data __old_functor = _M_functor; - _M_functor = __x._M_functor; - __x._M_functor = __old_functor; - _Manager_type __old_manager = _M_manager; - _M_manager = __x._M_manager; - __x._M_manager = __old_manager; - _Invoker_type __old_invoker = _M_invoker; - _M_invoker = __x._M_invoker; - __x._M_invoker = __old_invoker; + std::swap(_M_functor, __x._M_functor); + std::swap(_M_manager, __x._M_manager); + std::swap(_M_invoker, __x._M_invoker); } // TODO: needs allocator_arg_t Index: include/tr1/functional =================================================================== --- include/tr1/functional (revision 164927) +++ include/tr1/functional (working copy) @@ -1907,15 +1907,9 @@ */ void swap(function& __x) { - _Any_data __old_functor = _M_functor; - _M_functor = __x._M_functor; - __x._M_functor = __old_functor; - _Manager_type __old_manager = _M_manager; - _M_manager = __x._M_manager; - __x._M_manager = __old_manager; - _Invoker_type __old_invoker = _M_invoker; - _M_invoker = __x._M_invoker; - __x._M_invoker = __old_invoker; + std::swap(_M_functor, __x._M_functor); + std::swap(_M_manager, __x._M_manager); + std::swap(_M_invoker, __x._M_invoker); } // [3.7.2.3] function capacity