+2017-05-15 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/80761
+ * include/bits/node_handle.h (_Node_insert_return): Reorder members.
+ (tuple_size, tuple_element): Remove partial specializations.
+ * include/bits/stl_tree.h (_Rb_tree::insert_return_type): Use
+ const_iterator for std::set.
+ * testsuite/23_containers/map/modifiers/extract.cc: New.
+ * testsuite/23_containers/set/modifiers/extract.cc: New.
+ * testsuite/23_containers/unordered_map/modifiers/extract.cc: New.
+ * testsuite/23_containers/unordered_set/modifiers/extract.cc: New.
+
2017-05-12 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/78939
template<typename _Iterator, typename _NodeHandle>
struct _Node_insert_return
{
- bool inserted = false;
_Iterator position = _Iterator();
+ bool inserted = false;
_NodeHandle node;
template<size_t _Idx>
}
};
- template<typename _Iterator, typename _NodeHandle>
- struct tuple_size<_Node_insert_return<_Iterator, _NodeHandle>>
- : integral_constant<size_t, 3> { };
-
- template<typename _Iterator, typename _NodeHandle>
- struct tuple_element<0, _Node_insert_return<_Iterator, _NodeHandle>>
- { using type = bool; };
-
- template<typename _Iterator, typename _NodeHandle>
- struct tuple_element<1, _Node_insert_return<_Iterator, _NodeHandle>>
- { using type = _Iterator; };
-
- template<typename _Iterator, typename _NodeHandle>
- struct tuple_element<2, _Node_insert_return<_Iterator, _NodeHandle>>
- { using type = _NodeHandle; };
-
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#if __cplusplus > 201402L
using node_type = _Node_handle<_Key, _Val, _Node_allocator>;
- using insert_return_type = _Node_insert_return<iterator, node_type>;
+ using insert_return_type = _Node_insert_return<
+ conditional_t<is_same_v<_Key, _Val>, const_iterator, iterator>,
+ node_type>;
#endif
pair<_Base_ptr, _Base_ptr>
static_assert( is_same_v<test_type::node_type, compat_type3::node_type> );
}
+void
+test04()
+{
+ // Check order of members in insert_return_type
+ auto [pos, ins, node] = test_type::insert_return_type{};
+ using std::is_same_v;
+ static_assert( is_same_v<test_type::iterator, decltype(pos)> );
+ static_assert( is_same_v<bool, decltype(ins)> );
+ static_assert( is_same_v<test_type::node_type, decltype(node)> );
+}
+
int
main()
{
static_assert( is_same_v<test_type::node_type, compat_type3::node_type> );
}
+void
+test04()
+{
+ // Check order of members in insert_return_type
+ auto [pos, ins, node] = test_type::insert_return_type{};
+ using std::is_same_v;
+ static_assert( is_same_v<test_type::iterator, decltype(pos)> );
+ static_assert( is_same_v<bool, decltype(ins)> );
+ static_assert( is_same_v<test_type::node_type, decltype(node)> );
+}
+
int
main()
{
static_assert( is_same_v<test_type::node_type, compat_type3::node_type> );
}
+void
+test04()
+{
+ // Check order of members in insert_return_type
+ auto [pos, ins, node] = test_type::insert_return_type{};
+ using std::is_same_v;
+ static_assert( is_same_v<test_type::iterator, decltype(pos)> );
+ static_assert( is_same_v<bool, decltype(ins)> );
+ static_assert( is_same_v<test_type::node_type, decltype(node)> );
+}
+
int
main()
{
static_assert( is_same_v<test_type::node_type, compat_type3::node_type> );
}
+void
+test04()
+{
+ // Check order of members in insert_return_type
+ auto [pos, ins, node] = test_type::insert_return_type{};
+ using std::is_same_v;
+ static_assert( is_same_v<test_type::iterator, decltype(pos)> );
+ static_assert( is_same_v<bool, decltype(ins)> );
+ static_assert( is_same_v<test_type::node_type, decltype(node)> );
+}
+
int
main()
{