From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90378 invoked by alias); 3 May 2015 20:19:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 90356 invoked by uid 89); 3 May 2015 20:19:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wi0-f181.google.com Received: from mail-wi0-f181.google.com (HELO mail-wi0-f181.google.com) (209.85.212.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 03 May 2015 20:19:23 +0000 Received: by widdi4 with SMTP id di4so92035873wid.0; Sun, 03 May 2015 13:19:20 -0700 (PDT) X-Received: by 10.195.11.202 with SMTP id ek10mr35204330wjd.12.1430684360821; Sun, 03 May 2015 13:19:20 -0700 (PDT) Received: from [192.168.0.22] (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by mx.google.com with ESMTPSA id 16sm17389027wjs.41.2015.05.03.13.19.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 May 2015 13:19:19 -0700 (PDT) Message-ID: <554682C7.7030409@gmail.com> Date: Sun, 03 May 2015 20:19:00 -0000 From: =?windows-1252?Q?Fran=E7ois_Dumont?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jonathan Wakely CC: "libstdc++@gcc.gnu.org" , gcc-patches Subject: miter_base simplification References: <5538003D.30905@gmail.com> <20150427115515.GG3618@redhat.com> <5541EA9A.1010803@gmail.com> <20150430111815.GQ3618@redhat.com> In-Reply-To: <20150430111815.GQ3618@redhat.com> Content-Type: multipart/mixed; boundary="------------080906070105010208050106" X-SW-Source: 2015-05/txt/msg00180.txt.bz2 This is a multi-part message in MIME format. --------------080906070105010208050106 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-length: 993 On 30/04/2015 13:18, Jonathan Wakely wrote: > On 30/04/15 10:40 +0200, François Dumont wrote: >> On 27/04/2015 13:55, Jonathan Wakely wrote: >>> (Alternatively, could the same simplification be made for >>> __miter_base? Do we need _Miter_base<> or just two overloads of >>> __miter_base()?) >> >> Definitely, I already have a patch for that. > > Great :-) And here is the patch for this part. I have implemented it in such a way that it will also remove several layers of move_iterator. 2015-05-04 François Dumont * include/bits/cpp_type_traits.h (std::move_iterator): Delete declaration. (std::__is_move_iterator): Move partial specialization... * include/bits/stl_iterator.h: ... here. (std::__miter_base): Overloads for std::reverse_iterator and std::move_iterator. * include/bits/stl_algobase.h (std::__miter_base): Provide default implementation. Tested under Linux x86_64. Ok to commit ? François --------------080906070105010208050106 Content-Type: text/x-patch; name="miter.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="miter.patch" Content-length: 2921 Index: include/bits/cpp_type_traits.h =================================================================== --- include/bits/cpp_type_traits.h (revision 222751) +++ include/bits/cpp_type_traits.h (working copy) @@ -399,18 +399,6 @@ typedef __false_type __type; }; -#if __cplusplus >= 201103L - template - class move_iterator; - - template - struct __is_move_iterator< move_iterator<_Iterator> > - { - enum { __value = 1 }; - typedef __true_type __type; - }; -#endif - _GLIBCXX_END_NAMESPACE_VERSION } // namespace Index: include/bits/stl_algobase.h =================================================================== --- include/bits/stl_algobase.h (revision 222751) +++ include/bits/stl_algobase.h (working copy) @@ -277,17 +277,11 @@ __niter_base(_Iterator __it) { return __it; } - // If _Iterator is a move_iterator return its base otherwise return it - // untouched. See copy, fill, ... + // Likewise for move_iterator. template - struct _Miter_base - : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value> - { }; - - template - inline typename _Miter_base<_Iterator>::iterator_type + inline _Iterator __miter_base(_Iterator __it) - { return std::_Miter_base<_Iterator>::_S_base(__it); } + { return __it; } // All of these auxiliary structs serve two purposes. (1) Replace // calls to copy with memmove whenever possible. (Memmove, not memcpy, Index: include/bits/stl_iterator.h =================================================================== --- include/bits/stl_iterator.h (revision 222751) +++ include/bits/stl_iterator.h (working copy) @@ -414,6 +414,17 @@ __niter_base(reverse_iterator<_Iterator> __it) -> decltype(__make_reverse_iterator(__niter_base(__it.base()))) { return __make_reverse_iterator(__niter_base(__it.base())); } + + template + struct __is_move_iterator > + : __is_move_iterator<_Iterator> + { }; + + template + auto + __miter_base(reverse_iterator<_Iterator> __it) + -> decltype(__make_reverse_iterator(__miter_base(__it.base()))) + { return __make_reverse_iterator(__miter_base(__it.base())); } #endif // 24.4.2.2.1 back_insert_iterator @@ -1202,6 +1213,19 @@ -> decltype(make_move_iterator(__niter_base(__it.base()))) { return make_move_iterator(__niter_base(__it.base())); } + template + struct __is_move_iterator > + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template + auto + __miter_base(move_iterator<_Iterator> __it) + -> decltype(__miter_base(__it.base())) + { return __miter_base(__it.base()); } + _GLIBCXX_END_NAMESPACE_VERSION } // namespace --------------080906070105010208050106--