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.voutilai...@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