diff options
Diffstat (limited to 'libstdc++-v3/include')
23 files changed, 565 insertions, 65 deletions
diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h index d6c42ece5d..12c6c12f18 100644 --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -72,8 +72,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef _Alloc<_Tp, _Args...> __type; }; - template<typename _Ptr, typename _Tp> - using __alloc_rebind = typename __alloctr_rebind<_Ptr, _Tp>::__type; + template<typename _Alloc, typename _Tp> + using __alloc_rebind = typename __alloctr_rebind<_Alloc, _Tp>::__type; /** * @brief Uniform interface to all allocator types. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 3b2603fc65..f0d543a60e 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -377,7 +377,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 /** * @brief Default constructor creates an empty string. */ - basic_string() _GLIBCXX_NOEXCEPT + basic_string() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<_Alloc>::value) +#endif : _M_dataplus(_M_local_data()) { _M_set_length(0); } diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h index 9b49617b7a..de49dd517f 100644 --- a/libstdc++-v3/include/bits/locale_conv.h +++ b/libstdc++-v3/include/bits/locale_conv.h @@ -1,6 +1,6 @@ // wstring_convert implementation -*- C++ -*- -// Copyright (C) 2012 Free Software Foundation, Inc. +// Copyright (C) 2015 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -51,6 +51,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ +_GLIBCXX_BEGIN_NAMESPACE_CXX11 /// String conversions template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, @@ -192,18 +193,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_conv(const _InChar* __first, const _InChar* __last, const _OutStr* __err, _MemFn __memfn) { + auto __outstr = __err ? _OutStr(__err->get_allocator()) : _OutStr(); + + if (__first == __last) + { + _M_count = 0; + return __outstr; + } + if (!_M_with_cvtstate) _M_state = state_type(); - auto __outstr = __err ? _OutStr(__err->get_allocator()) : _OutStr(); size_t __outchars = 0; auto __next = __first; - const auto __maxlen = _M_cvt->max_length(); + const auto __maxlen = _M_cvt->max_length() + 1; codecvt_base::result __result; do { - __outstr.resize(__outstr.size() + (__last - __next) + __maxlen); + __outstr.resize(__outstr.size() + (__last - __next) * __maxlen); auto __outnext = &__outstr.front() + __outchars; auto const __outlast = &__outstr.back() + 1; __result = ((*_M_cvt).*__memfn)(_M_state, __next, __last, __next, @@ -239,6 +247,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_with_cvtstate = false; bool _M_with_strings = false; }; +_GLIBCXX_END_NAMESPACE_CXX11 /// Buffer conversions template<typename _Codecvt, typename _Elem = wchar_t, @@ -264,7 +273,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_buf(__bytebuf), _M_cvt(__pcvt), _M_state(__state) { if (!_M_cvt) - __throw_logic_error("wstring_convert"); + __throw_logic_error("wbuffer_convert"); _M_always_noconv = _M_cvt->always_noconv(); diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 90401350d9..2b69e61895 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -715,8 +715,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c) { const _Tp __tmp = __c; - __builtin_memset(__first, static_cast<unsigned char>(__tmp), - __last - __first); + if (const size_t __len = __last - __first) + __builtin_memset(__first, static_cast<unsigned char>(__tmp), __len); } /** @@ -822,8 +822,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static bool equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) { - return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) - * (__last1 - __first1)); + if (const size_t __len = (__last1 - __first1)) + return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len); + return true; } }; @@ -927,9 +928,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { const size_t __len1 = __last1 - __first1; const size_t __len2 = __last2 - __first2; - const int __result = __builtin_memcmp(__first1, __first2, - std::min(__len1, __len2)); - return __result != 0 ? __result < 0 : __len1 < __len2; + if (const size_t __len = std::min(__len1, __len2)) + if (int __result = __builtin_memcmp(__first1, __first2, __len)) + return __result < 0; + return __len1 < __len2; } }; diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 7b93d9508c..71bee213a8 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -573,6 +573,9 @@ template<typename _Alloc> public: vector() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<allocator_type>::value) +#endif : _Base() { } explicit diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index df18973931..179e3f2a0b 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -160,6 +160,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ map() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<allocator_type>::value) +#endif : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index f3d21ab8be..10ac0fadea 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -158,6 +158,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ multimap() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<allocator_type>::value) +#endif : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 7e92836aae..0a476d1b08 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -138,6 +138,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ multiset() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<allocator_type>::value) +#endif : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 5189234357..2e5c89f22c 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -140,6 +140,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ set() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<allocator_type>::value) +#endif : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 5ca8e28ef4..d39042f1aa 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_valptr() const { return std::__addressof(_M_value_field); } #else - __gnu_cxx::__aligned_buffer<_Val> _M_storage; + __gnu_cxx::__aligned_membuf<_Val> _M_storage; _Val* _M_valptr() @@ -188,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_node() { } explicit - _Rb_tree_iterator(_Link_type __x) _GLIBCXX_NOEXCEPT + _Rb_tree_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT : _M_node(__x) { } reference @@ -260,7 +260,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_node() { } explicit - _Rb_tree_const_iterator(_Link_type __x) _GLIBCXX_NOEXCEPT + _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT : _M_node(__x) { } _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT @@ -268,8 +268,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION iterator _M_const_cast() const _GLIBCXX_NOEXCEPT - { return iterator(static_cast<typename iterator::_Link_type> - (const_cast<typename iterator::_Base_ptr>(_M_node))); } + { return iterator(const_cast<typename iterator::_Base_ptr>(_M_node)); } reference operator*() const _GLIBCXX_NOEXCEPT @@ -868,28 +867,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION iterator begin() _GLIBCXX_NOEXCEPT - { - return iterator(static_cast<_Link_type> - (this->_M_impl._M_header._M_left)); - } + { return iterator(this->_M_impl._M_header._M_left); } const_iterator begin() const _GLIBCXX_NOEXCEPT - { - return const_iterator(static_cast<_Const_Link_type> - (this->_M_impl._M_header._M_left)); - } + { return const_iterator(this->_M_impl._M_header._M_left); } iterator end() _GLIBCXX_NOEXCEPT - { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); } + { return iterator(&this->_M_impl._M_header); } const_iterator end() const _GLIBCXX_NOEXCEPT - { - return const_iterator(static_cast<_Const_Link_type> - (&this->_M_impl._M_header)); - } + { return const_iterator(&this->_M_impl._M_header); } reverse_iterator rbegin() _GLIBCXX_NOEXCEPT diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 92b75d1dfc..3c434abb6a 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_map(const unordered_map& __umap, const allocator_type& __a) - : _M_h(__umap._M_h, __a) + : _M_h(__umap._M_h, __a) { } /* @@ -200,7 +200,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_map(unordered_map&& __umap, const allocator_type& __a) - : _M_h(std::move(__umap._M_h), __a) + : _M_h(std::move(__umap._M_h), __a) { } /** @@ -219,7 +219,42 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + unordered_map(size_type __n, const allocator_type& __a) + : unordered_map(__n, hasher(), key_equal(), __a) + { } + + unordered_map(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_map(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_map(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_map(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__l, __n, __hf, key_equal(), __a) { } /// Copy assignment operator. @@ -320,7 +355,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // modifiers. /** - * @brief Attempts to build and insert a std::pair into the %unordered_map. + * @brief Attempts to build and insert a std::pair into the + * %unordered_map. * * @param __args Arguments used to generate a new pair instance (see * std::piecewise_contruct for passing arguments to each @@ -344,7 +380,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h.emplace(std::forward<_Args>(__args)...); } /** - * @brief Attempts to build and insert a std::pair into the %unordered_map. + * @brief Attempts to build and insert a std::pair into the + * %unordered_map. * * @param __pos An iterator that serves as a hint as to where the pair * should be inserted. @@ -535,7 +572,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @param __x An %unordered_map of the same element and allocator * types. * - * This exchanges the elements between two %unordered_map in constant time. + * This exchanges the elements between two %unordered_map in constant + * time. * Note that the global std::swap() function is specialized such that * std::swap(m1,m2) will feed to this function. */ @@ -895,7 +933,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ explicit unordered_multimap(const allocator_type& __a) - : _M_h(__a) + : _M_h(__a) { } /* @@ -905,7 +943,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_multimap(const unordered_multimap& __ummap, const allocator_type& __a) - : _M_h(__ummap._M_h, __a) + : _M_h(__ummap._M_h, __a) { } /* @@ -915,7 +953,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_multimap(unordered_multimap&& __ummap, const allocator_type& __a) - : _M_h(std::move(__ummap._M_h), __a) + : _M_h(std::move(__ummap._M_h), __a) { } /** @@ -934,7 +972,42 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + unordered_multimap(size_type __n, const allocator_type& __a) + : unordered_multimap(__n, hasher(), key_equal(), __a) + { } + + unordered_multimap(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multimap(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multimap(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__l, __n, __hf, key_equal(), __a) { } /// Copy assignment operator. @@ -1055,7 +1128,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h.emplace(std::forward<_Args>(__args)...); } /** - * @brief Attempts to build and insert a std::pair into the %unordered_multimap. + * @brief Attempts to build and insert a std::pair into the + * %unordered_multimap. * * @param __pos An iterator that serves as a hint as to where the pair * should be inserted. diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 7a2546c825..664d97ef27 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -174,7 +174,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ explicit unordered_set(const allocator_type& __a) - : _M_h(__a) + : _M_h(__a) { } /* @@ -184,7 +184,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_set(const unordered_set& __uset, const allocator_type& __a) - : _M_h(__uset._M_h, __a) + : _M_h(__uset._M_h, __a) { } /* @@ -194,7 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_set(unordered_set&& __uset, const allocator_type& __a) - : _M_h(std::move(__uset._M_h), __a) + : _M_h(std::move(__uset._M_h), __a) { } /** @@ -213,7 +213,42 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + unordered_set(size_type __n, const allocator_type& __a) + : unordered_set(__n, hasher(), key_equal(), __a) + { } + + unordered_set(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_set(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_set(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_set(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__l, __n, __hf, key_equal(), __a) { } /// Copy assignment operator. @@ -702,8 +737,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template<typename _Value1, typename _Hash1, typename _Pred1, typename _Alloc1> friend bool - operator==(const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&, - const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&); + operator==(const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&, + const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&); }; /** @@ -823,7 +858,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _M_h(__l, __n, __hf, __eql, __a) + : _M_h(__l, __n, __hf, __eql, __a) { } /// Copy assignment operator. @@ -840,7 +875,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ explicit unordered_multiset(const allocator_type& __a) - : _M_h(__a) + : _M_h(__a) { } /* @@ -850,7 +885,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_multiset(const unordered_multiset& __umset, const allocator_type& __a) - : _M_h(__umset._M_h, __a) + : _M_h(__umset._M_h, __a) { } /* @@ -860,7 +895,42 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_multiset(unordered_multiset&& __umset, const allocator_type& __a) - : _M_h(std::move(__umset._M_h), __a) + : _M_h(std::move(__umset._M_h), __a) + { } + + unordered_multiset(size_type __n, const allocator_type& __a) + : unordered_multiset(__n, hasher(), key_equal(), __a) + { } + + unordered_multiset(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multiset(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multiset(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__l, __n, __hf, key_equal(), __a) { } /** @@ -871,8 +941,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * in the initializer list @a __l. * * Note that the assignment completely changes the %unordered_multiset - * and that the resulting %unordered_set's size is the same as the number - * of elements assigned. Old data may be lost. + * and that the resulting %unordered_multiset's size is the same as the + * number of elements assigned. Old data may be lost. */ unordered_multiset& operator=(initializer_list<value_type> __l) diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array index 31d146e935..411e816d31 100644 --- a/libstdc++-v3/include/debug/array +++ b/libstdc++-v3/include/debug/array @@ -216,11 +216,11 @@ namespace __debug pointer data() noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems); } const_pointer data() const noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems); } }; // Array comparisons. diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map index a6bf9a68c1..3f46641d67 100644 --- a/libstdc++-v3/include/debug/unordered_map +++ b/libstdc++-v3/include/debug/unordered_map @@ -129,6 +129,44 @@ namespace __debug const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } + unordered_map(size_type __n, const allocator_type& __a) + : unordered_map(__n, hasher(), key_equal(), __a) + { } + + unordered_map(size_type __n, + const hasher& __hf, + const allocator_type& __a) + : unordered_map(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const hasher& __hf, + const allocator_type& __a) + : unordered_map(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_map(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_map(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_map(initializer_list<value_type> __l, + size_type __n, + const hasher& __hf, + const allocator_type& __a) + : unordered_map(__l, __n, __hf, key_equal(), __a) + { } + ~unordered_map() = default; unordered_map& @@ -544,6 +582,41 @@ namespace __debug const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } + unordered_multimap(size_type __n, const allocator_type& __a) + : unordered_multimap(__n, hasher(), key_equal(), __a) + { } + + unordered_multimap(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multimap(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multimap(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__l, __n, __hf, key_equal(), __a) + { } + ~unordered_multimap() = default; unordered_multimap& diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index afa0a3d465..10a9c270ed 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -129,6 +129,41 @@ namespace __debug const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } + unordered_set(size_type __n, const allocator_type& __a) + : unordered_set(__n, hasher(), key_equal(), __a) + { } + + unordered_set(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_set(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_set(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_set(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__l, __n, __hf, key_equal(), __a) + { } + ~unordered_set() = default; unordered_set& @@ -540,6 +575,41 @@ namespace __debug const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } + unordered_multiset(size_type __n, const allocator_type& __a) + : unordered_multiset(__n, hasher(), key_equal(), __a) + { } + + unordered_multiset(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multiset(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multiset(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__l, __n, __hf, key_equal(), __a) + { } + ~unordered_multiset() = default; unordered_multiset& diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index 40bc6132da..bf0a88eb01 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -69,13 +69,17 @@ namespace __gnu_debug _Safe_vector& operator=(const _Safe_vector&) noexcept - { _M_update_guaranteed_capacity(); } + { + _M_update_guaranteed_capacity(); + return *this; + } _Safe_vector& operator=(_Safe_vector&& __x) noexcept { _M_update_guaranteed_capacity(); __x._M_guaranteed_capacity = 0; + return *this; } #endif diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index 8c205d5cad..487ba01679 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -94,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::aligned_storage<sizeof(_M_ptr), sizeof(_M_ptr)>::type _M_buffer; }; - template<typename _Tp, typename _Safe = is_nothrow_move_constructible<_Tp>, + template<typename _Tp, typename _Safe = is_trivially_copyable<_Tp>, bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))> using _Internal = std::integral_constant<bool, _Safe::value && _Fits>; diff --git a/libstdc++-v3/include/ext/aligned_buffer.h b/libstdc++-v3/include/ext/aligned_buffer.h index 01f5729786..d023bc189e 100644 --- a/libstdc++-v3/include/ext/aligned_buffer.h +++ b/libstdc++-v3/include/ext/aligned_buffer.h @@ -39,6 +39,47 @@ namespace __gnu_cxx { + // A utility type containing a POD object that can hold an object of type + // _Tp initialized via placement new or allocator_traits::construct. + // Intended for use as a data member subobject, use __aligned_buffer for + // complete objects. + template<typename _Tp> + struct __aligned_membuf + { + // Target macro ADJUST_FIELD_ALIGN can produce different alignment for + // types when used as class members. __aligned_membuf is intended + // for use as a class member, so align the buffer as for a class member. + struct _Tp2 { _Tp _M_t; }; + + alignas(__alignof__(_Tp2::_M_t)) unsigned char _M_storage[sizeof(_Tp)]; + + __aligned_membuf() = default; + + // Can be used to avoid value-initialization zeroing _M_storage. + __aligned_membuf(std::nullptr_t) { } + + void* + _M_addr() noexcept + { return static_cast<void*>(&_M_storage); } + + const void* + _M_addr() const noexcept + { return static_cast<const void*>(&_M_storage); } + + _Tp* + _M_ptr() noexcept + { return static_cast<_Tp*>(_M_addr()); } + + const _Tp* + _M_ptr() const noexcept + { return static_cast<const _Tp*>(_M_addr()); } + }; + + // Similar to __aligned_membuf but aligned for complete objects, not members. + // This type is used in <forward_list>, <future>, <bits/shared_ptr_base.h> + // and <bits/hashtable_policy.h>, but ideally they would use __aligned_membuf + // instead, as it has smaller size for some types on some targets. + // This type is still used to avoid an ABI change. template<typename _Tp> struct __aligned_buffer : std::aligned_storage<sizeof(_Tp), std::alignment_of<_Tp>::value> diff --git a/libstdc++-v3/include/profile/array b/libstdc++-v3/include/profile/array index a90e396cae..5198bb3af9 100644 --- a/libstdc++-v3/include/profile/array +++ b/libstdc++-v3/include/profile/array @@ -178,11 +178,11 @@ namespace __profile pointer data() noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems); } const_pointer data() const noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems); } }; // Array comparisons. diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index fdb4550cdc..480fabad17 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -119,6 +119,41 @@ namespace __profile const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } + unordered_map(size_type __n, const allocator_type& __a) + : unordered_map(__n, hasher(), key_equal(), __a) + { } + + unordered_map(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_map(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_map(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_map(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__l, __n, __hf, key_equal(), __a) + { } + unordered_map& operator=(const unordered_map&) = default; @@ -361,6 +396,41 @@ namespace __profile const allocator_type& __a = allocator_type()) : _Base(__l, __n, __hf, __eql, __a) { } + unordered_multimap(size_type __n, const allocator_type& __a) + : unordered_multimap(__n, hasher(), key_equal(), __a) + { } + + unordered_multimap(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multimap(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multimap(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__l, __n, __hf, key_equal(), __a) + { } + unordered_multimap& operator=(const unordered_multimap&) = default; diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set index e1eb1a17d3..15950b9f47 100644 --- a/libstdc++-v3/include/profile/unordered_set +++ b/libstdc++-v3/include/profile/unordered_set @@ -125,6 +125,41 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } + unordered_set(size_type __n, const allocator_type& __a) + : unordered_set(__n, hasher(), key_equal(), __a) + { } + + unordered_set(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_set(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_set(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_set(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__l, __n, __hf, key_equal(), __a) + { } + unordered_set& operator=(const unordered_set&) = default; @@ -346,6 +381,41 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } + unordered_multiset(size_type __n, const allocator_type& __a) + : unordered_multiset(__n, hasher(), key_equal(), __a) + { } + + unordered_multiset(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__n, __hf, key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template<typename _InputIterator> + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multiset(initializer_list<value_type> __l, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multiset(initializer_list<value_type> __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__l, __n, __hf, key_equal(), __a) + { } + unordered_multiset& operator=(const unordered_multiset&) = default; diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 429506b385..24be44f5b1 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -51,6 +51,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER static constexpr _Tp& _S_ref(const _Type& __t, std::size_t __n) noexcept { return const_cast<_Tp&>(__t[__n]); } + + static constexpr _Tp* + _S_ptr(const _Type& __t) noexcept + { return const_cast<_Tp*>(__t); } }; template<typename _Tp> @@ -61,6 +65,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER static constexpr _Tp& _S_ref(const _Type&, std::size_t) noexcept { return *static_cast<_Tp*>(nullptr); } + + static constexpr _Tp* + _S_ptr(const _Type&) noexcept + { return nullptr; } }; /** @@ -219,11 +227,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER pointer data() noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems); } const_pointer data() const noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems); } }; // Array comparisons. diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits index 550d81fa84..793683f521 100644 --- a/libstdc++-v3/include/std/limits +++ b/libstdc++-v3/include/std/limits @@ -1490,7 +1490,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION min() _GLIBCXX_USE_NOEXCEPT { return 0; } \ \ static _GLIBCXX_CONSTEXPR unsigned TYPE \ - max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ + max() _GLIBCXX_USE_NOEXCEPT \ + { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \ \ UEXT \ \ |