public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes.
@ 2017-10-17 20:00 Ville Voutilainen
  2017-10-26 14:38 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Voutilainen @ 2017-10-17 20:00 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

Tested on Linux-PPC64. The debug mode fixes have been tested manually
and individually on Linux-x64.

2017-10-17  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Deduction guides for associative containers, debug mode deduction
guide fixes.
    * include/bits/stl_algobase.h (__iter_key_t)
    (__iter_val_t, __iter_to_alloc_t): New.
    * include/bits/stl_map.h: Add deduction guides.
    * include/bits/stl_multimap.h: Likewise.
    * include/bits/stl_multiset.h: Likewise.
    * include/bits/stl_set.h: Likewise.
    * include/bits/unordered_map.h: Likewise.
    * include/bits/unordered_set.h: Likewise.
    * include/debug/deque: Likewise.
    * include/debug/forward_list: Likewise.
    * include/debug/list: Likewise.
    * include/debug/map.h: Likewise.
    * include/debug/multimap.h: Likewise.
    * include/debug/multiset.h: Likewise.
    * include/debug/set.h: Likewise.
    * include/debug/unordered_map: Likewise.
    * include/debug/unordered_set: Likewise.
    * include/debug/vector: Likewise.
    * testsuite/23_containers/map/cons/deduction.cc: New.
    * testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
    * testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
    * testsuite/23_containers/set/cons/deduction.cc: Likewise.
    * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
    * testsuite/23_containers/unordered_multimap/cons/deduction.cc:
    Likewise.
    * testsuite/23_containers/unordered_multiset/cons/deduction.cc:
    Likewise.
    * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

[-- Attachment #2: deduction_guidos.diff.gz --]
[-- Type: application/x-gzip, Size: 4334 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes.
  2017-10-17 20:00 [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes Ville Voutilainen
@ 2017-10-26 14:38 ` Jonathan Wakely
  2017-10-26 15:09   ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2017-10-26 14:38 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: libstdc++, gcc-patches

On 17/10/17 22:48 +0300, Ville Voutilainen wrote:
>Tested on Linux-PPC64. The debug mode fixes have been tested manually
>and individually on Linux-x64.
>
>2017-10-17  Ville Voutilainen  <ville.voutilainen@gmail.com>
>
>    Deduction guides for associative containers, debug mode deduction
>guide fixes.
>    * include/bits/stl_algobase.h (__iter_key_t)
>    (__iter_val_t, __iter_to_alloc_t): New.
>    * include/bits/stl_map.h: Add deduction guides.
>    * include/bits/stl_multimap.h: Likewise.
>    * include/bits/stl_multiset.h: Likewise.
>    * include/bits/stl_set.h: Likewise.
>    * include/bits/unordered_map.h: Likewise.
>    * include/bits/unordered_set.h: Likewise.
>    * include/debug/deque: Likewise.
>    * include/debug/forward_list: Likewise.
>    * include/debug/list: Likewise.
>    * include/debug/map.h: Likewise.
>    * include/debug/multimap.h: Likewise.
>    * include/debug/multiset.h: Likewise.
>    * include/debug/set.h: Likewise.
>    * include/debug/unordered_map: Likewise.
>    * include/debug/unordered_set: Likewise.
>    * include/debug/vector: Likewise.
>    * testsuite/23_containers/map/cons/deduction.cc: New.
>    * testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/set/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/unordered_multimap/cons/deduction.cc:
>    Likewise.
>    * testsuite/23_containers/unordered_multiset/cons/deduction.cc:
>    Likewise.
>    * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.



>--- a/libstdc++-v3/include/bits/stl_algobase.h
>+++ b/libstdc++-v3/include/bits/stl_algobase.h

This doesn't seem like the right place for these.

Maybe stl_iterator.h with forward declarations of pair and allocator
if needed?


>@@ -1429,6 +1429,25 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
> #endif
>
> _GLIBCXX_END_NAMESPACE_ALGO
>+
>+#if __cplusplus > 201402L
>+
>+  template<typename _InputIterator>
>+  using __iter_key_t = remove_const_t<
>+    typename iterator_traits<_InputIterator>::value_type::first_type>;
>+
>+ template<typename _InputIterator>
>+   using __iter_val_t =
>+   typename iterator_traits<_InputIterator>::value_type::second_type;
>+
>+ template<typename _InputIterator>
>+   using __iter_to_alloc_t =
>+   pair<add_const_t<typename
>+                   iterator_traits<_InputIterator>::value_type::first_type>,
>+       typename iterator_traits<_InputIterator>::value_type::second_type>;


Inconsistent indentation for these three. Please use:

  template<...>
    using ...
      ...

Would the third one be simpler as:

  template<typename _InputIterator>
    using __iter_to_alloc_t =
      pair<add_const_t<__iter_key_t<_InputIterator>>,
           __iter_val_t<_InputIterator>>


>--- a/libstdc++-v3/include/bits/stl_map.h
>+++ b/libstdc++-v3/include/bits/stl_map.h
>@@ -1366,6 +1366,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>                  const map<_K1, _T1, _C1, _A1>&);
>     };
>
>+
>+#if __cpp_deduction_guides >= 201606
>+
>+ template<typename _InputIterator,

The additions to this file seem to be indented by only one space not
two.

>+    set(_InputIterator, _InputIterator,
>+       _Compare = _Compare(), _Allocator = _Allocator())
>+   -> set<typename iterator_traits<_InputIterator>::value_type,
>+         _Compare, _Allocator>;

The first line seems to be indented wrong here too.

A stray newline has crept into include/debug/unordered_set:

>@@ -1031,6 +1159,7 @@ namespace __debug
>               const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
>     { return !(__x == __y); }
>
>+
> } // namespace __debug
> } // namespace std

I notice there are no copyright headers in the new test. imokwiththis.jpg


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes.
  2017-10-26 14:38 ` Jonathan Wakely
@ 2017-10-26 15:09   ` Jonathan Wakely
  2017-10-26 16:30     ` Ville Voutilainen
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2017-10-26 15:09 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: libstdc++, gcc-patches

On 26/10/17 15:36 +0100, Jonathan Wakely wrote:
>On 17/10/17 22:48 +0300, Ville Voutilainen wrote:
>>Tested on Linux-PPC64. The debug mode fixes have been tested manually
>>and individually on Linux-x64.
>>
>>2017-10-17  Ville Voutilainen  <ville.voutilainen@gmail.com>
>>
>>   Deduction guides for associative containers, debug mode deduction
>>guide fixes.
>>   * include/bits/stl_algobase.h (__iter_key_t)
>>   (__iter_val_t, __iter_to_alloc_t): New.
>>   * include/bits/stl_map.h: Add deduction guides.
>>   * include/bits/stl_multimap.h: Likewise.
>>   * include/bits/stl_multiset.h: Likewise.
>>   * include/bits/stl_set.h: Likewise.
>>   * include/bits/unordered_map.h: Likewise.
>>   * include/bits/unordered_set.h: Likewise.

Also, please put the deduction guides for a class immediately after
the definition of that class, rather than grouping all the guides for
unordered_map and unordered_multimap together.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes.
  2017-10-26 15:09   ` Jonathan Wakely
@ 2017-10-26 16:30     ` Ville Voutilainen
  2017-10-26 16:31       ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Voutilainen @ 2017-10-26 16:30 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]

On 26 October 2017 at 18:04, Jonathan Wakely <jwakely@redhat.com> wrote:
> Also, please put the deduction guides for a class immediately after
> the definition of that class, rather than grouping all the guides for
> unordered_map and unordered_multimap together.


Alright.

2017-10-26  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Deduction guides for associative containers, debug mode deduction
guide fixes.
    * include/bits/stl_iterator.h (__iter_key_t)
    (__iter_val_t, __iter_to_alloc_t): New.
    * include/bits/stl_map.h: Add deduction guides.
    * include/bits/stl_multimap.h: Likewise.
    * include/bits/stl_multiset.h: Likewise.
    * include/bits/stl_set.h: Likewise.
    * include/bits/unordered_map.h: Likewise.
    * include/bits/unordered_set.h: Likewise.
    * include/debug/deque: Likewise.
    * include/debug/forward_list: Likewise.
    * include/debug/list: Likewise.
    * include/debug/map.h: Likewise.
    * include/debug/multimap.h: Likewise.
    * include/debug/multiset.h: Likewise.
    * include/debug/set.h: Likewise.
    * include/debug/unordered_map: Likewise.
    * include/debug/unordered_set: Likewise.
    * include/debug/vector: Likewise.
    * testsuite/23_containers/map/cons/deduction.cc: New.
    * testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
    * testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
    * testsuite/23_containers/set/cons/deduction.cc: Likewise.
    * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
    * testsuite/23_containers/unordered_multimap/cons/deduction.cc:
    Likewise.
    * testsuite/23_containers/unordered_multiset/cons/deduction.cc:
    Likewise.
    * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

[-- Attachment #2: deduction_guidos_3.diff.bz2 --]
[-- Type: application/x-bzip2, Size: 4207 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes.
  2017-10-26 16:30     ` Ville Voutilainen
@ 2017-10-26 16:31       ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2017-10-26 16:31 UTC (permalink / raw)
  To: Ville Voutilainen; +Cc: libstdc++, gcc-patches

On 26/10/17 19:23 +0300, Ville Voutilainen wrote:
>On 26 October 2017 at 18:04, Jonathan Wakely <jwakely@redhat.com> wrote:
>> Also, please put the deduction guides for a class immediately after
>> the definition of that class, rather than grouping all the guides for
>> unordered_map and unordered_multimap together.
>
>
>Alright.
>
>2017-10-26  Ville Voutilainen  <ville.voutilainen@gmail.com>
>
>    Deduction guides for associative containers, debug mode deduction
>guide fixes.
>    * include/bits/stl_iterator.h (__iter_key_t)
>    (__iter_val_t, __iter_to_alloc_t): New.
>    * include/bits/stl_map.h: Add deduction guides.
>    * include/bits/stl_multimap.h: Likewise.
>    * include/bits/stl_multiset.h: Likewise.
>    * include/bits/stl_set.h: Likewise.
>    * include/bits/unordered_map.h: Likewise.
>    * include/bits/unordered_set.h: Likewise.
>    * include/debug/deque: Likewise.
>    * include/debug/forward_list: Likewise.
>    * include/debug/list: Likewise.
>    * include/debug/map.h: Likewise.
>    * include/debug/multimap.h: Likewise.
>    * include/debug/multiset.h: Likewise.
>    * include/debug/set.h: Likewise.
>    * include/debug/unordered_map: Likewise.
>    * include/debug/unordered_set: Likewise.
>    * include/debug/vector: Likewise.
>    * testsuite/23_containers/map/cons/deduction.cc: New.
>    * testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/set/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
>    * testsuite/23_containers/unordered_multimap/cons/deduction.cc:
>    Likewise.
>    * testsuite/23_containers/unordered_multiset/cons/deduction.cc:
>    Likewise.
>    * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

OK for trunk - thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-26 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17 20:00 [v3 PATCH] Deduction guides for associative containers, debug mode deduction guide fixes Ville Voutilainen
2017-10-26 14:38 ` Jonathan Wakely
2017-10-26 15:09   ` Jonathan Wakely
2017-10-26 16:30     ` Ville Voutilainen
2017-10-26 16:31       ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).