aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/alloc_traits.h72
-rw-r--r--libstdc++-v3/include/bits/basic_string.h23
-rw-r--r--libstdc++-v3/include/bits/locale_classes.h5
-rw-r--r--libstdc++-v3/include/bits/predefined_ops.h14
-rw-r--r--libstdc++-v3/include/bits/ptr_traits.h15
-rw-r--r--libstdc++-v3/include/bits/stl_map.h30
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h28
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h24
-rw-r--r--libstdc++-v3/include/bits/stl_set.h26
-rw-r--r--libstdc++-v3/include/experimental/any5
-rw-r--r--libstdc++-v3/include/experimental/array12
-rw-r--r--libstdc++-v3/include/experimental/memory4
-rw-r--r--libstdc++-v3/include/ext/pointer.h8
-rw-r--r--libstdc++-v3/include/std/atomic36
-rw-r--r--libstdc++-v3/include/std/type_traits6
15 files changed, 177 insertions, 131 deletions
diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h
index d2d13c692af..25ad9486a5b 100644
--- a/libstdc++-v3/include/bits/alloc_traits.h
+++ b/libstdc++-v3/include/bits/alloc_traits.h
@@ -44,8 +44,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __allocator_traits_base
{
- template<typename _Alloc, typename _Up>
- using __rebind = typename _Alloc::template rebind<_Up>::other;
+ template<typename _Tp, typename _Up, typename = void>
+ struct __rebind : __replace_first_arg<_Tp, _Up> { };
+
+ template<typename _Tp, typename _Up>
+ struct __rebind<_Tp, _Up,
+ __void_t<typename _Tp::template rebind<_Up>::other>>
+ { using type = typename _Tp::template rebind<_Up>::other; };
protected:
template<typename _Tp>
@@ -57,10 +62,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
using __cv_pointer = typename _Tp::const_void_pointer;
template<typename _Tp>
- using __diff_type = typename _Tp::difference_type;
- template<typename _Tp>
- using __size_type = typename _Tp::size_type;
- template<typename _Tp>
using __pocca = typename _Tp::propagate_on_container_copy_assignment;
template<typename _Tp>
using __pocma = typename _Tp::propagate_on_container_move_assignment;
@@ -71,9 +72,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _Alloc, typename _Up>
- using __alloc_rebind = __detected_or_t_<__replace_first_arg_t,
- __allocator_traits_base::__rebind,
- _Alloc, _Up>;
+ using __alloc_rebind
+ = typename __allocator_traits_base::template __rebind<_Alloc, _Up>::type;
/**
* @brief Uniform interface to all allocator types.
@@ -94,15 +94,45 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
using pointer = __detected_or_t<value_type*, __pointer, _Alloc>;
+ private:
+ // Select _Func<_Alloc> or pointer_traits<pointer>::rebind<_Tp>
+ template<template<typename> class _Func, typename _Tp, typename = void>
+ struct _Ptr
+ {
+ using type = typename pointer_traits<pointer>::template rebind<_Tp>;
+ };
+
+ template<template<typename> class _Func, typename _Tp>
+ struct _Ptr<_Func, _Tp, __void_t<_Func<_Alloc>>>
+ {
+ using type = _Func<_Alloc>;
+ };
+
+ // Select _A2::difference_type or pointer_traits<_Ptr>::difference_type
+ template<typename _A2, typename _PtrT, typename = void>
+ struct _Diff
+ { using type = typename pointer_traits<_PtrT>::difference_type; };
+
+ template<typename _A2, typename _PtrT>
+ struct _Diff<_A2, _PtrT, __void_t<typename _A2::difference_type>>
+ { using type = typename _A2::difference_type; };
+
+ // Select _A2::size_type or make_unsigned<_DiffT>::type
+ template<typename _A2, typename _DiffT, typename = void>
+ struct _Size : make_unsigned<_DiffT> { };
+
+ template<typename _A2, typename _DiffT>
+ struct _Size<_A2, _DiffT, __void_t<typename _A2::size_type>>
+ { using type = typename _A2::size_type; };
+
+ public:
/**
* @brief The allocator's const pointer type.
*
* @c Alloc::const_pointer if that type exists, otherwise
* <tt> pointer_traits<pointer>::rebind<const value_type> </tt>
*/
- using const_pointer
- = __detected_or_t<__ptr_rebind<pointer, const value_type>,
- __c_pointer, _Alloc>;
+ using const_pointer = typename _Ptr<__c_pointer, const value_type>::type;
/**
* @brief The allocator's void pointer type.
@@ -110,8 +140,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @c Alloc::void_pointer if that type exists, otherwise
* <tt> pointer_traits<pointer>::rebind<void> </tt>
*/
- using void_pointer
- = __detected_or_t<__ptr_rebind<pointer, void>, __v_pointer, _Alloc>;
+ using void_pointer = typename _Ptr<__v_pointer, void>::type;
/**
* @brief The allocator's const void pointer type.
@@ -119,9 +148,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @c Alloc::const_void_pointer if that type exists, otherwise
* <tt> pointer_traits<pointer>::rebind<const void> </tt>
*/
- using const_void_pointer
- = __detected_or_t<__ptr_rebind<pointer, const void>, __cv_pointer,
- _Alloc>;
+ using const_void_pointer = typename _Ptr<__cv_pointer, const void>::type;
/**
* @brief The allocator's difference type
@@ -129,9 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @c Alloc::difference_type if that type exists, otherwise
* <tt> pointer_traits<pointer>::difference_type </tt>
*/
- using difference_type
- = __detected_or_t<typename pointer_traits<pointer>::difference_type,
- __diff_type, _Alloc>;
+ using difference_type = typename _Diff<_Alloc, pointer>::type;
/**
* @brief The allocator's size type
@@ -139,9 +164,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @c Alloc::size_type if that type exists, otherwise
* <tt> make_unsigned<difference_type>::type </tt>
*/
- using size_type
- = __detected_or_t<typename make_unsigned<difference_type>::type,
- __size_type, _Alloc>;
+ using size_type = typename _Size<_Alloc, difference_type>::type;
/**
* @brief How the allocator is propagated on copy assignment
@@ -184,9 +207,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
- static_assert(!is_same<rebind_alloc<value_type>, __undefined>::value,
- "allocator defines rebind or is like Alloc<T, Args>");
-
private:
template<typename _Alloc2>
static auto
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index f8f3f88cc56..0352bf49fdc 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -570,10 +570,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
&& _M_get_allocator() != __str._M_get_allocator())
{
- // replacement allocator cannot free existing storage
- _M_destroy(_M_allocated_capacity);
- _M_data(_M_local_data());
- _M_set_length(0);
+ // Propagating allocator cannot free existing storage so must
+ // deallocate it before replacing current allocator.
+ if (__str.size() <= _S_local_capacity)
+ {
+ _M_destroy(_M_allocated_capacity);
+ _M_data(_M_local_data());
+ _M_set_length(0);
+ }
+ else
+ {
+ const auto __len = __str.size();
+ auto __alloc = __str._M_get_allocator();
+ // If this allocation throws there are no effects:
+ auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
+ _M_destroy(_M_allocated_capacity);
+ _M_data(__ptr);
+ _M_capacity(__len);
+ _M_set_length(__len);
+ }
}
std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
}
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index 04b4ab3b1d3..16ed623ccc7 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -461,10 +461,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
- class __shim;
-
const facet* _M_sso_shim(const id*) const;
const facet* _M_cow_shim(const id*) const;
+
+ protected:
+ class __shim; // For internal use only.
};
diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h
index d254795c1a5..7f4bfe65f31 100644
--- a/libstdc++-v3/include/bits/predefined_ops.h
+++ b/libstdc++-v3/include/bits/predefined_ops.h
@@ -24,7 +24,7 @@
/** @file predefined_ops.h
* This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
+ * You should not attempt to use it directly. @headername{algorithm}
*/
#ifndef _GLIBCXX_PREDEFINED_OPS_H
@@ -207,17 +207,17 @@ namespace __ops
template<typename _Iterator1>
struct _Iter_equals_iter
{
- typename std::iterator_traits<_Iterator1>::reference _M_ref;
+ _Iterator1 _M_it1;
explicit
_Iter_equals_iter(_Iterator1 __it1)
- : _M_ref(*__it1)
+ : _M_it1(__it1)
{ }
template<typename _Iterator2>
bool
operator()(_Iterator2 __it2)
- { return *__it2 == _M_ref; }
+ { return *__it2 == *_M_it1; }
};
template<typename _Iterator>
@@ -271,16 +271,16 @@ namespace __ops
struct _Iter_comp_to_iter
{
_Compare _M_comp;
- typename std::iterator_traits<_Iterator1>::reference _M_ref;
+ _Iterator1 _M_it1;
_Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
- : _M_comp(__comp), _M_ref(*__it1)
+ : _M_comp(__comp), _M_it1(__it1)
{ }
template<typename _Iterator2>
bool
operator()(_Iterator2 __it2)
- { return bool(_M_comp(*__it2, _M_ref)); }
+ { return bool(_M_comp(*__it2, *_M_it1)); }
};
template<typename _Compare, typename _Iterator>
diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/bits/ptr_traits.h
index 023f21efc77..98cc9c59e89 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -56,7 +56,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Given Template<T, ...> and U return Template<U, ...>, otherwise invalid.
template<typename _Tp, typename _Up>
struct __replace_first_arg
- { using type = __undefined; };
+ { };
template<template<typename, typename...> class _Template, typename _Up,
typename _Tp, typename... _Types>
@@ -84,8 +84,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
using __difference_type = typename _Tp::difference_type;
+ template<typename _Tp, typename _Up, typename = void>
+ struct __rebind : __replace_first_arg<_Tp, _Up> { };
+
template<typename _Tp, typename _Up>
- using __rebind = typename _Tp::template rebind<_Up>;
+ struct __rebind<_Tp, _Up, __void_t<typename _Tp::template rebind<_Up>>>
+ { using type = typename _Tp::template rebind<_Up>; };
public:
/// The pointer type.
@@ -93,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// The type pointed to.
using element_type
- = __detected_or_t_<__get_first_arg_t, __element_type, _Ptr>;
+ = __detected_or_t<__get_first_arg_t<_Ptr>, __element_type, _Ptr>;
/// The type used to represent the difference between two pointers.
using difference_type
@@ -101,8 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// A pointer to a different type.
template<typename _Up>
- using rebind
- = __detected_or_t_<__replace_first_arg_t, __rebind, _Ptr, _Up>;
+ using rebind = typename __rebind<_Ptr, _Up>::type;
static _Ptr
pointer_to(__make_not_void<element_type>& __e)
@@ -110,8 +113,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(!is_same<element_type, __undefined>::value,
"pointer type defines element_type or is like SomePointer<T, Args>");
- static_assert(!is_same<rebind<element_type>, __undefined>::value,
- "pointer type defines rebind<U> or is like SomePointer<T, Args>");
};
/**
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index f2934838098..48c591ce7cf 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -1129,7 +1129,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
- { return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; }
+ { return _M_t._M_count_tr(__x); }
#endif
//@}
@@ -1153,8 +1153,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -1178,8 +1178,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+ { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -1198,8 +1198,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -1218,8 +1218,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
+ { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -1247,8 +1247,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
@@ -1276,8 +1276,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x)))
+ {
+ return pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x));
+ }
#endif
//@}
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index d48935e56d3..eb6b24bcbc1 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -822,8 +822,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -847,8 +847,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+ { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -867,8 +867,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -887,8 +887,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
+ { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -914,8 +914,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
@@ -941,8 +941,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x)))
+ {
+ return pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x));
+ }
#endif
//@}
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 03a3e7dc861..b45e0be962b 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -716,14 +716,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -746,14 +746,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -785,14 +785,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index d8cdcc5b292..2b5a787e26b 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -670,7 +670,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
auto
count(const _Kt& __x) const
-> decltype(_M_t._M_count_tr(__x))
- { return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; }
+ { return _M_t._M_count_tr(__x); }
#endif
//@}
@@ -735,14 +735,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+ { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -765,14 +765,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -804,14 +804,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index 5e091a45dda..1695f103b5c 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -425,7 +425,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
void* __any_caster(const any* __any)
{
- if (__any->_M_manager != &any::_Manager<decay_t<_Tp>>::_S_manage)
+ struct _None { };
+ using _Up = decay_t<_Tp>;
+ using _Vp = conditional_t<is_copy_constructible<_Up>::value, _Up, _None>;
+ if (__any->_M_manager != &any::_Manager<_Vp>::_S_manage)
return nullptr;
any::_Arg __arg;
__any->_M_manager(any::_Op_access, __any, &__arg);
diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array
index 31a066b3ce8..c01f0f96ab5 100644
--- a/libstdc++-v3/include/experimental/array
+++ b/libstdc++-v3/include/experimental/array
@@ -69,9 +69,9 @@ template <typename _Up>
template <typename _Dest = void, typename... _Types>
constexpr auto
make_array(_Types&&... __t)
- -> array<conditional_t<is_void_v<_Dest>,
- common_type_t<_Types...>,
- _Dest>,
+ -> array<typename conditional_t<is_void_v<_Dest>,
+ common_type<_Types...>,
+ common_type<_Dest>>::type,
sizeof...(_Types)>
{
static_assert(__or_<
@@ -80,13 +80,12 @@ template <typename _Dest = void, typename... _Types>
::value,
"make_array cannot be used without an explicit target type "
"if any of the types given is a reference_wrapper");
- return {{forward<_Types>(__t)...}};
+ return {{ std::forward<_Types>(__t)... }};
}
template <typename _Tp, size_t _Nm, size_t... _Idx>
constexpr array<remove_cv_t<_Tp>, _Nm>
- __to_array(_Tp (&__a)[_Nm],
- index_sequence<_Idx...>)
+ __to_array(_Tp (&__a)[_Nm], index_sequence<_Idx...>)
{
return {{__a[_Idx]...}};
}
@@ -94,6 +93,7 @@ template <typename _Tp, size_t _Nm, size_t... _Idx>
template <typename _Tp, size_t _Nm>
constexpr array<remove_cv_t<_Tp>, _Nm>
to_array(_Tp (&__a)[_Nm])
+ noexcept(is_nothrow_constructible<remove_cv_t<_Tp>, _Tp&>::value)
{
return __to_array(__a, make_index_sequence<_Nm>{});
}
diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory
index 885d11cb351..8b3b8844a03 100644
--- a/libstdc++-v3/include/experimental/memory
+++ b/libstdc++-v3/include/experimental/memory
@@ -124,9 +124,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr __pointer
release() noexcept
{
- __pointer tmp = get();
+ __pointer __tmp = get();
reset();
- return tmp;
+ return __tmp;
}
constexpr void
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index c3c98a19182..75c8fbeae45 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -449,9 +449,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline _Pointer_adapter
operator++(int)
{
- _Pointer_adapter tmp(*this);
+ _Pointer_adapter __tmp(*this);
_Storage_policy::set(_Storage_policy::get() + 1);
- return tmp;
+ return __tmp;
}
inline _Pointer_adapter&
@@ -464,9 +464,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline _Pointer_adapter
operator--(int)
{
- _Pointer_adapter tmp(*this);
+ _Pointer_adapter __tmp(*this);
_Storage_policy::set(_Storage_policy::get() - 1);
- return tmp;
+ return __tmp;
}
}; // class _Pointer_adapter
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index bdc1f25e542..a218a4dcc2d 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -230,35 +230,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Tp
load(memory_order __m = memory_order_seq_cst) const noexcept
- {
- _Tp tmp;
- __atomic_load(&_M_i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_load(&_M_i, __ptr, __m);
+ return *__ptr;
}
_Tp
load(memory_order __m = memory_order_seq_cst) const volatile noexcept
- {
- _Tp tmp;
- __atomic_load(&_M_i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_load(&_M_i, __ptr, __m);
+ return *__ptr;
}
_Tp
exchange(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept
- {
- _Tp tmp;
- __atomic_exchange(&_M_i, &__i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_exchange(&_M_i, &__i, __ptr, __m);
+ return *__ptr;
}
_Tp
exchange(_Tp __i,
memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- _Tp tmp;
- __atomic_exchange(&_M_i, &__i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_exchange(&_M_i, &__i, __ptr, __m);
+ return *__ptr;
}
bool
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 584b842edcd..15deb90b2ef 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2576,12 +2576,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __detected_or_t
= typename __detected_or<_Default, _Op, _Args...>::type;
- // _Op<_Args...> if that is a valid type, otherwise _Default<_Args...>.
- template<template<typename...> class _Default,
- template<typename...> class _Op, typename... _Args>
- using __detected_or_t_ =
- __detected_or_t<_Default<_Args...>, _Op, _Args...>;
-
/// @} group metaprogramming
/**