summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/alloc_traits.h
Commit message (Collapse)AuthorAgeFilesLines
* libstdc++: Ensure all feature test macros have type long [PR87193]Jonathan Wakely2022-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This defines all the __cpp_lib_xxx macros as type long, as required by the standard. We had an inconsistent mix of int and long, sometimes even for the same macro name. The __cpp_lib_experimental_xxx macros are left as type int, because that's what it says in the relevant TS specs. libstdc++-v3/ChangeLog: PR libstdc++/87193 PR libstdc++/104019 * include/bits/alloc_traits.h (__cpp_lib_allocator_traits_is_always_equal): Define as type long. * include/bits/allocator.h (__cpp_lib_incomplete_container_elements): Likewise. * include/bits/basic_string.h (__cpp_lib_string_udls): Likewise. * include/bits/chrono.h (__cpp_lib_chrono): Likewise. (__cpp_lib_chrono_udls): Likewise. * include/bits/move.h (__cpp_lib_addressof_constexpr): Likewise. * include/bits/node_handle.h (__cpp_lib_node_extract): Likewise. * include/bits/range_access.h (__cpp_lib_nonmember_container_access): Likewise. * include/bits/shared_ptr.h (__cpp_lib_enable_shared_from_this): Likewise. * include/bits/stl_algo.h (__cpp_lib_clamp): Likewise. (__cpp_lib_sample): Likewise. * include/bits/stl_algobase.h (__cpp_lib_robust_nonmodifying_seq_ops): Likewise. * include/bits/stl_function.h (__cpp_lib_transparent_operators): Likewise. * include/bits/stl_iterator.h (__cpp_lib_make_reverse_iterator): Likewise. * include/bits/stl_map.h (__cpp_lib_map_try_emplace): Likewise. * include/bits/stl_tree.h (__cpp_lib_generic_associative_lookup): Likewise. * include/bits/unique_ptr.h (__cpp_lib_make_unique): Likewise. * include/bits/unordered_map.h (__cpp_lib_unordered_map_try_emplace): Likewise. * include/c_global/cmath (__cpp_lib_hypot): Likewise. * include/c_global/cstddef (__cpp_lib_byte): Likewise. * include/std/atomic (__cpp_lib_atomic_is_always_lock_free): Likewise. * include/std/complex (__cpp_lib_complex_udls): Likewise. * include/std/filesystem (__cpp_lib_filesystem): Likewise. * include/std/functional (__cpp_lib_not_fn): Likewise. (__cpp_lib_boyer_moore_searcher): Likewise. * include/std/iomanip (__cpp_lib_quoted_string_io): Likewise. * include/std/mutex (__cpp_lib_scoped_lock): Likewise. * include/std/numeric (__cpp_lib_gcd_lcm): Likewise. (__cpp_lib_gcd, __cpp_lib_lcm): Likewise. * include/std/tuple (__cpp_lib_apply): Likewise. (__cpp_lib_make_from_tuple): Likewise. * include/std/type_traits (__cpp_lib_integral_constant_callable) (__cpp_lib_bool_constant, __cpp_lib_logical_traits) (__cpp_lib_is_null_pointer, __cpp_lib_transformation_trait_aliases) (__cpp_lib_result_of_sfinae, __cpp_lib_void_t) (__cpp_lib_is_swappable, __cpp_lib_is_invocable) (__cpp_lib_has_unique_object_representations) (__cpp_lib_is_aggregate): Likewise. * include/std/version: Likewise. * libsupc++/new (__cpp_lib_launder): Likewise.
* libstdc++: Simplify std::allocator_traits<allocator<void>>::constructJonathan Wakely2022-01-051-7/+1
| | | | | | | | | | | We don't need a preprocessor condition to decide whether to use placement new or std::construct_at, because std::_Construct already does that. libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h (allocator_traits<allocator<void>>): Use std::_Construct for construct.
* Update copyright years.Jakub Jelinek2022-01-031-1/+1
|
* libstdc++: Implement constexpr std::vector for C++20Jonathan Wakely2021-11-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements P1004R2 ("Making std::vector constexpr") for C++20. For now, debug mode vectors are not supported in constant expressions. To make that work we might need to disable all attaching/detaching of safe iterators. That can be fixed later. Co-authored-by: Josh Marshall <joshua.r.marshall.1991@gmail.com> libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h (_Destroy): Make constexpr for C++20 mode. * include/bits/allocator.h (__shrink_to_fit::_S_do_it): Likewise. * include/bits/stl_algobase.h (__fill_a1): Declare _Bit_iterator overload constexpr for C++20. * include/bits/stl_bvector.h (_Bit_type, _S_word_bit): Move out of inline namespace. (_Bit_reference, _Bit_iterator_base, _Bit_iterator) (_Bit_const_iterator, _Bvector_impl_data, _Bvector_base) (vector<bool, A>>): Add constexpr to every member function. (_Bvector_base::_M_allocate): Initialize storage during constant evaluation. (vector<bool, A>::_M_initialize_value): Use __fill_bvector_n instead of memset. (__fill_bvector_n): New helper function to replace memset during constant evaluation. * include/bits/stl_uninitialized.h (__uninitialized_copy<false>): Move logic to ... (__do_uninit_copy): New function. (__uninitialized_fill<false>): Move logic to ... (__do_uninit_fill): New function. (__uninitialized_fill_n<false>): Move logic to ... (__do_uninit_fill_n): New function. (__uninitialized_copy_a): Add constexpr. Use __do_uninit_copy. (__uninitialized_move_a, __uninitialized_move_if_noexcept_a): Add constexpr. (__uninitialized_fill_a): Add constexpr. Use __do_uninit_fill. (__uninitialized_fill_n_a): Add constexpr. Use __do_uninit_fill_n. (__uninitialized_default_n, __uninitialized_default_n_a) (__relocate_a_1, __relocate_a): Add constexpr. * include/bits/stl_vector.h (_Vector_impl_data, _Vector_impl) (_Vector_base, vector): Add constexpr to every member function. (_Vector_impl::_S_adjust): Disable ASan annotation during constant evaluation. (_Vector_base::_S_use_relocate): Disable bitwise-relocation during constant evaluation. (vector::_Temporary_value): Use a union for storage. * include/bits/vector.tcc (vector, vector<bool>): Add constexpr to every member function. * include/std/vector (erase_if, erase): Add constexpr. * testsuite/23_containers/headers/vector/synopsis.cc: Add constexpr for C++20 mode. * testsuite/23_containers/vector/bool/cmp_c++20.cc: Change to compile-only test using constant expressions. * testsuite/23_containers/vector/bool/capacity/29134.cc: Adjust namespace for _S_word_bit. * testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Likewise. * testsuite/23_containers/vector/cmp_c++20.cc: Likewise. * testsuite/23_containers/vector/cons/89164.cc: Adjust errors for C++20 and move C++17 test to ... * testsuite/23_containers/vector/cons/89164_c++17.cc: ... here. * testsuite/23_containers/vector/bool/capacity/constexpr.cc: New test. * testsuite/23_containers/vector/bool/cons/constexpr.cc: New test. * testsuite/23_containers/vector/bool/element_access/constexpr.cc: New test. * testsuite/23_containers/vector/bool/modifiers/assign/constexpr.cc: New test. * testsuite/23_containers/vector/bool/modifiers/constexpr.cc: New test. * testsuite/23_containers/vector/bool/modifiers/swap/constexpr.cc: New test. * testsuite/23_containers/vector/capacity/constexpr.cc: New test. * testsuite/23_containers/vector/cons/constexpr.cc: New test. * testsuite/23_containers/vector/data_access/constexpr.cc: New test. * testsuite/23_containers/vector/element_access/constexpr.cc: New test. * testsuite/23_containers/vector/modifiers/assign/constexpr.cc: New test. * testsuite/23_containers/vector/modifiers/constexpr.cc: New test. * testsuite/23_containers/vector/modifiers/swap/constexpr.cc: New test.
* libstdc++: Suppress Doxygen docs for more implementation detailsJonathan Wakely2021-10-211-0/+4
| | | | | | | | | | | | | | | libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h: Suppress doxygen documentation. * include/bits/allocated_ptr.h: Likewise. * include/bits/enable_special_members.h: Likewise. * include/bits/hashtable.h: Likewise. * include/bits/hashtable_policy.h: Likewise. * include/bits/uses_allocator.h: Likewise. * include/bits/node_handle.h: Document node handles and suppress documentation for protected members. * include/std/any: Suppress documentation for implementation details.
* libstdc++: Fix std::allocator<void> for versioned namespaceJonathan Wakely2021-08-281-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing the allocator<void> specialization for the versioned namespace breaks _Extptr_allocator<void> because the allocator<void> specialization was still declared in <bits/memoryfwd.h>, making it an incomplete type. It wrong to remove that specialization anyway, because it is still needed pre-C++20. This removes the #if ! _GLIBCXX_INLINE_VERSION check, so that allocator<void> is still explicitly specialized for the versioned namespace, consistent with the normal unversioned namespace mode. To make _Extptr_allocator<void> usable as a ProtoAllocator, this change adds a default constructor and converting constructor. That is consistent with std::allocator<void> since C++20 (and harmless to do for earlier standards). I'm also explicitly specializing allocator_traits<allocator<void>> so that it doesn't need to use allocator<void>::construct and destroy. Doing that allows those members to be removed, further simplifying allocator<void>. That new explicit specialization can delete the allocate, deallocate and max_size members, which are always ill-formed for allocator<void>. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h (allocator_traits): Add explicit specialization for allocator<void>. Improve doxygen comments. * include/bits/allocator.h (allocator<void>): Restore for the versioned namespace. (allocator<void>::construct, allocator<void>::destroy): Remove. * include/ext/extptr_allocator.h (_Extptr_allocator<void>): Add default constructor and converting constructor.
* libstdc++: Fix Doxygen warningsJonathan Wakely2021-04-061-1/+1
| | | | | | | | | | | | | libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h: Use markdown for code font. * include/bits/basic_string.h: Fix @param names. * include/bits/max_size_type.h: Remove period after @file. * include/bits/regex.h: Fix duplicate @retval names, and rename. * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Add group open to match existing group close. * include/ext/pb_ds/priority_queue.hpp: Add blank line before group open.
* Update copyright years.Jakub Jelinek2021-01-041-1/+1
|
* libstdc++: Add remaining C++20 additions to <sstream> [P0408R7]Jonathan Wakely2020-11-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the new overloads of basic_stringbuf::str, and the corresponding overloads to basic_istringstream, basic_ostringstream and basic_stringstream. libstdc++-v3/ChangeLog: * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Tighten patterns. (GLIBCXX_3.4.29): Export new symbols. * include/bits/alloc_traits.h (__allocator_like): New concept. * include/std/sstream (basic_stringbuf::swap): Add exception specification. (basic_stringbuf::str() const): Add ref-qualifier. Use new _M_high_mark function. (basic_stringbuf::str(const SAlloc&) const): Define new function. (basic_stringbuf::str() &&): Likewise. (basic_stringbuf::str(const basic_string<C,T,SAlloc>&)): Likewise. (basic_stringbuf::str(basic_string<C,T,Alloc>&&)): Likewise. (basic_stringbuf::view() const): Use _M_high_mark. (basic_istringstream::str, basic_ostringstream::str) (basic_stringstream::str): Define new overloads. * src/c++20/sstream-inst.cc (basic_stringbuf::str) (basic_istringstream::str, basic_ostringstream::str) (basic_stringstream::str): Explicit instantiation definitions for new overloads. * testsuite/27_io/basic_istringstream/view/char/1.cc: Add more checks. * testsuite/27_io/basic_istringstream/view/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise. * testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise. * testsuite/27_io/basic_stringstream/view/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_istringstream/str/char/2.cc: New test. * testsuite/27_io/basic_istringstream/str/wchar_t/2.cc: New test. * testsuite/27_io/basic_ostringstream/str/char/3.cc: New test. * testsuite/27_io/basic_ostringstream/str/wchar_t/3.cc: New test. * testsuite/27_io/basic_stringbuf/str/char/4.cc: New test. * testsuite/27_io/basic_stringbuf/str/wchar_t/4.cc: New test. * testsuite/27_io/basic_stringstream/str/char/5.cc: New test. * testsuite/27_io/basic_stringstream/str/wchar_t/5.cc.cc: New test.
* libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510)Jonathan Wakely2020-04-301-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression due to the conditional noexcept-specifier on std::allocator::construct and std::allocator::destroy, as well as the corresponding members of new_allocator, malloc_allocator, and allocator_traits. Those noexcept-specifiers were using expressions which might be ill-formed, which caused errors outside the immediate context when checking for the presence of construct and destroy in SFINAE contexts. The fix is to use the is_nothrow_constructible and is_nothrow_destructible type traits instead, because those traits are safe to use even when the construction/destruction itself is not valid. The is_nothrow_constructible trait will be false for a type that is not also nothrow-destructible, even if the new-expression used in the construct function body is actually noexcept. That's not the correct answer, but isn't a problem because providing a noexcept-specifier on these functions is not required by the standard anyway. If the answer is false when it should be true, that's suboptimal but OK (unlike giving errors for valid code, or giving a true answer when it should be false). PR libstdc++/89510 * include/bits/alloc_traits.h (allocator_traits::_S_construct) (allocator_traits::_S_destroy) (allocator_traits<allocator<T>>::construct): Use traits in noexcept-specifiers. * include/bits/allocator.h (allocator<void>::construct) (allocator<void>::destroy): Likewise. * include/ext/malloc_allocator.h (malloc_allocator::construct) (malloc_allocator::destroy): Likewise. * include/ext/new_allocator.h (new_allocator::construct) (new_allocator::destroy): Likewise. * testsuite/20_util/allocator/89510.cc: New test. * testsuite/ext/malloc_allocator/89510.cc: New test. * testsuite/ext/new_allocator/89510.cc: New test.
* libstdc++: Fix regression in std::_Construct (PR 94831)Jonathan Wakely2020-04-281-1/+7
| | | | | | | | | | | | | | | | | | | | | By trying to reuse the existing std::_Construct function as a wrapper for std::construct_at I introduced regressions, because changing std::_Construct to return non-void made it ill-formed for array types. The solution is to revert _Construct to its former state, and change allocator_traits::construct to explicitly call construct_at instead. This decouples all the existing callers of _Construct from the new construct_at requirements. PR libstdc++/94831 * include/bits/alloc_traits.h (_S_construct): Restore placement new-expression for C++11/14/17 and call std::construct_at directly for C++20. * include/bits/stl_construct.h (_Construct): Revert to non-constexpr function returning void. * testsuite/20_util/specialized_algorithms/ uninitialized_value_construct/94831.cc: New test. * testsuite/23_containers/vector/cons/94831.cc: New test.
* Update copyright years.Jakub Jelinek2020-01-011-1/+1
| | | | From-SVN: r279813
* libstdc++: Add inline to maybe-constexpr functions (PR 92927)Jonathan Wakely2019-12-201-3/+3
| | | | | | | | | | | | | | Originally these functions were always inline. I changed them in r277342 to be always constexpr, then in r277588 changed them to be constexpr for C++14, but I didn't restore the 'inline' for C++11. That leads to linker errors when libstdc++.so is built unoptimized, because those functions don't get instantiated in src/c++11/string-inst.o PR libstdc++/92927 * include/bits/alloc_traits.h (__alloc_on_copy, __alloc_on_move) (__alloc_on_swap): Add inline specifier. From-SVN: r279656
* libstdc++: Fix some -Wsystem-headers warningsJonathan Wakely2019-11-181-4/+5
| | | | | | | | | | * include/bits/alloc_traits.h (allocator_traits::construct) (allocator_traits::destroy, allocator_traits::max_size): Add unused attributes to parameters that are not used in C++20. * include/std/bit (__ceil2): Add braces around assertion to avoid -Wmissing-braces warning. From-SVN: r278401
* Fix compilation errors with ClangJonathan Wakely2019-10-291-7/+11
| | | | | | | | | | | * include/bits/alloc_traits.h (__cpp_lib_constexpr_dynamic_alloc): Define. (allocator_traits::_S_construct, allocator_traits::_S_destroy) (__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use _GLIBCXX14_CONSTEXPR instead of constexpr. * include/bits/stl_construct.h (_Destroy): Likewise. From-SVN: r277588
* PR c++/91369 Implement P0784R7 changes to allocation and constructionJonathan Wakely2019-10-231-42/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the first part of library support for constexpr std::vector and std::string. This only includes the changes to std::allocator, std::allocator_traits, std::construct_at, std::destroy_at, std::destroy and std::destroy_n. std::allocator::allocate and std::allocator::deallocate need to be added so that they can be intercepted by the compiler during constant evaluation. Outside of constant evaluation those new member functions just forward to the existing implementation in the base class. PR c++/91369 Implement P0784R7 changes to allocation and construction * include/bits/alloc_traits.h: Include <bits/stl_construct.h>. (allocator_traits::_S_allocate, allocator_traits::_S_construct) (allocator_traits::_S_destroy, allocator_traits::_S_max_size) (allocator_traits::_S_select, allocator_traits::allocate) (allocator_traits::deallocate, allocator_traits::construct) (allocator_traits::destroy, allocator_traits::max_size) (allocator_traits::select_on_container_copy_construction) (allocator_traits<allocator<T>>): Add constexpr specifier for C++20. (allocator_traits<allocator<T>>::construct): Use construct_at. (allocator_traits<allocator<T>>::destroy): Use destroy_at. (__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Add constexpr specifier. (_Destroy(ForwardIterator, ForwardIterator, Alloc&)) (_Destroy(ForwardIterator, ForwardIterator, allocator<T>&)): Move here from <bits/stl_construct.h>. * include/bits/allocator.h (allocator::~allocator): Remove for C++20. (allocator::allocate, allocate::deallocate): Define for C++20 and up. (operator==, operator!=): Add constexpr specifier for C++20. * include/bits/stl_construct.h: Don't include <ext/alloc_traits.h>. (destroy_at): For C++20 add constexpr specifier and support for destroying arrays. (construct_at): Define new function for C++20. (_Construct): Return result of placement new-expression. For C++11 and up add constexpr. For C++20 dispatch to std::construct_at during constant evaluation. (_Destroy(pointer)): Add constexpr specifier. For C++20 dispatch to std::destroy_at during constant evaluation. (_Destroy_aux::__destroy, _Destroy_n_aux::__destroy_n): Add constexpr specifier for C++20. (_Destroy(ForwardIterator, ForwardIterator)) (_Destroy(ForwardIterator, Size)): Likewise. Do not elide trivial destructors during constant evaluation. (destroy, destroy_n): Add constexpr specifier for C++20. (_Destroy(ForwardIterator, ForwardIterator, Alloc&)) (_Destroy(ForwardIterator, ForwardIterator, allocator<T>&)): Move to <bits/alloc_traits.h>, to remove dependency on allocators. * include/bits/stl_uninitialized.h: Include <ext/alloc_traits.h>. Include <bits/stl_pair.h> instead of <utility>. * include/ext/alloc_traits.h: Always include <bits/alloc_traits.h>. (__alloc_traits::construct, __alloc_traits::destroy) (__alloc_traits::_S_select_on_copy, __alloc_traits::_S_on_swap): Add constexpr specifier. * include/ext/malloc_allocator.h (operator==, operator!=): Add constexpr specifier for C++20. * include/ext/new_allocator.h (operator==, operator!=): Likewise. * testsuite/20_util/headers/memory/synopsis.cc: Add constexpr. * testsuite/20_util/scoped_allocator/69293_neg.cc: Ignore additional errors due to constexpr function called after failed static_assert. * testsuite/20_util/specialized_algorithms/construct_at/1.cc: New test. * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Ignore additional errors due to constexpr function called after failed static_assert. * testsuite/23_containers/vector/cons/destructible_neg.cc: Likewise. From-SVN: r277342
* Remove redundant std::allocator members for C++20Jonathan Wakely2019-10-221-7/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 removes a number of std::allocator members that have correct defaults provided by std::allocator_traits, so aren't needed. Several extensions including __gnu_cxx::hash_map and tr1 containers are no longer usable with std::allocator in C++20 mode. They need to be updated to use __gnu_cxx::__alloc_traits in a follow-up patch. * include/bits/alloc_traits.h (allocator_traits<allocator<T>>::allocate): Ignore hint for C++20. (allocator_traits<allocator<T>>::construct): Perform placement new directly for C++20, instead of calling allocator<T>::construct. (allocator_traits<allocator<T>>::destroy): Call destructor directly for C++20, instead of calling allocator<T>::destroy. (allocator_traits<allocator<T>>::max_size): Return value directly for C++20, instead of calling std::allocator<T>::max_size(). (__do_alloc_on_copy, __do_alloc_on_move, __do_alloc_on_swap): Do not define for C++17 and up. (__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use if-constexpr for C++17 and up, instead of tag dispatching. * include/bits/allocator.h (allocator<void>): Remove for C++20. (allocator::pointer, allocator::const_pointer, allocator::reference) (allocator::const_reference, allocator::rebind): Remove for C++20. * include/bits/basic_string.h (basic_string): Use __alloc_traits to rebind allocator. * include/bits/memoryfwd.h (allocator<void>): Remove for C++20. * include/ext/debug_allocator.h: Use __alloc_traits for rebinding. * include/ext/malloc_allocator.h (malloc_allocator::~malloc_allocator) (malloc_allocator::pointer, malloc_allocator::const_pointer) (malloc_allocator::reference, malloc_allocator::const_reference) (malloc_allocator::rebind, malloc_allocator::max_size) (malloc_allocator::construct, malloc_allocator::destroy): Do not define for C++20. (malloc_allocator::_M_max_size): Define new function. * include/ext/new_allocator.h (new_allocator::~new_allocator) (new_allocator::pointer, new_allocator::const_pointer) (new_allocator::reference, new_allocator::const_reference) (new_allocator::rebind, new_allocator::max_size) (new_allocator::construct, new_allocator::destroy): Do not define for C++20. (new_allocator::_M_max_size): Define new function. * include/ext/rc_string_base.h (__rc_string_base::_Rep): Use __alloc_traits to rebind allocator. * include/ext/rope (_Rope_rep_base, _Rope_base): Likewise. (rope::rope(CharT, const allocator_type&)): Use __alloc_traits to construct character. * include/ext/slist (_Slist_base): Use __alloc_traits to rebind allocator. * include/ext/sso_string_base.h (__sso_string_base::_M_max_size): Use __alloc_traits. * include/ext/throw_allocator.h (throw_allocator): Do not use optional members of std::allocator, use __alloc_traits members instead. * include/ext/vstring.h (__versa_string): Use __alloc_traits. * include/ext/vstring_util.h (__vstring_utility): Likewise. * include/std/memory: Include <bits/alloc_traits.h>. * testsuite/20_util/allocator/8230.cc: Use __gnu_test::max_size. * testsuite/20_util/allocator/rebind_c++20.cc: New test. * testsuite/20_util/allocator/requirements/typedefs.cc: Do not check for pointer, const_pointer, reference, const_reference or rebind in C++20. * testsuite/20_util/allocator/requirements/typedefs_c++20.cc: New test. * testsuite/23_containers/deque/capacity/29134.cc: Use __gnu_test::max_size. * testsuite/23_containers/forward_list/capacity/1.cc: Likewise. * testsuite/23_containers/list/capacity/29134.cc: Likewise. * testsuite/23_containers/map/capacity/29134.cc: Likewise. * testsuite/23_containers/multimap/capacity/29134.cc: Likewise. * testsuite/23_containers/multiset/capacity/29134.cc: Likewise. * testsuite/23_containers/set/capacity/29134.cc: Likewise. * testsuite/23_containers/vector/capacity/29134.cc: Likewise. * testsuite/ext/malloc_allocator/variadic_construct.cc: Do not run test for C++20. * testsuite/ext/new_allocator/variadic_construct.cc: Likewise. * testsuite/ext/vstring/capacity/29134.cc: Use __gnu_test::max_size. * testsuite/util/replacement_memory_operators.h: Do not assume Alloc::pointer exists. * testsuite/util/testsuite_allocator.h (__gnu_test::max_size): Define helper to call max_size for any allocator. From-SVN: r277300
* PR libstdc++/89477 constrain deduction guides for maps and setsJonathan Wakely2019-02-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Compare, Hash, and Pred template parameters should be constrained in the C++17 deduction guides for associative and unordered containers. The deduction guides for stack, queue and priority_queue are already constrained, but this patch makes them use the _RequireNotAllocator helper instead of reproducing the logic each time. PR libstdc++/89477 * include/bits/alloc_traits.h (_RequireNotAllocator): New helper for container deduction guides. * include/bits/hashtable.h (_RequireNotAllocatorOrIntegral): Likewise. * include/bits/stl_map.h (map): Use _RequireNotAllocator to constrain parameters in deduction guides. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_queue.h (queue, priority_queue): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_stack.h (stack): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): use _RequireNotAllocator and _RequireNotAllocatorOrIntegral to constrain parameters in deduction guides. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/map/cons/deduction.cc: Test additional deduction cases. * 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. From-SVN: r269234
* PR libstdc++/89416 fix alloc insertable trait for clang (again)Jonathan Wakely2019-02-261-23/+21
| | | | | | | | | PR libstdc++/89416 * include/bits/alloc_traits.h (__is_alloc_insertable_impl): Change to class template and partial specialization using void_t. (__is_copy_insertable, __is_move_insertable): Adjust base class. From-SVN: r269229
* PR libstdc++/89416 fix accessibility of membersJonathan Wakely2019-02-241-1/+1
| | | | | | | | PR libstdc++/89416 * include/bits/alloc_traits.h (__is_alloc_insertable_impl): Make copy and move members public. From-SVN: r269175
* PR libstdc++/89416 fix __is_move_insertable traitJonathan Wakely2019-02-211-22/+21
| | | | | | | | | | | | | | | | | | | | | The common base class for __is_move_insertable and __is_copy_insertable instantiates both the copy and move tests, when only one is needed. The unneeded one might cause errors outside the immediate context. The solution used in this patch is to replace them with alias templates, which will only be instantiated as needed. PR libstdc++/89416 * include/bits/alloc_traits.h (__is_alloc_insertable_impl): Replace class template with class. Replace move and copy member types with member alias templates, so they are only instantiated when needed. (__is_copy_insertable, __is_move_insertable): Adjust base class. * testsuite/23_containers/vector/modifiers/push_back/89130.cc: Enable test for C++11/14/17 as well. * testsuite/23_containers/vector/modifiers/push_back/89416.cc: New test. From-SVN: r269075
* PR libstdc++/89130 restore support for non-MoveConstructible typesJonathan Wakely2019-02-051-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The changes to "relocate" std::vector elements can lead to new errors outside the immediate context, because moving the elements to new storage no longer makes use of the move-if-noexcept utilities. This means that types with deleted moves no longer degenerate to copies, but are just ill-formed. The errors happen while instantiating the noexcept-specifier for __relocate_object_a, when deciding whether to try to relocate. This patch introduces indirections to avoid the ill-formed instantiations of std::__relocate_object_a. In order to avoid using if-constexpr prior to C++17 this is done by tag dispatching. After this patch all uses of std::__relocate_a are guarded by checks that will support sensible code (i.e. code not using custom allocators that fool the new checks). PR libstdc++/89130 * include/bits/alloc_traits.h (__is_copy_insertable_impl): Rename to __is_alloc_insertable_impl. Replace single type member with two members, one for each of copy and move insertable. (__is_move_insertable): New trait for internal use. * include/bits/stl_vector.h (vector::_S_nothrow_relocate(true_type)) (vector::_S_nothrow_relocate(true_type)): New functions to conditionally check if __relocate_a can throw. (vector::_S_use_relocate()): Dispatch to _S_nothrow_relocate based on __is_move_insertable. (vector::_S_do_relocate): New overloaded functions to conditionally call __relocate_a. (vector::_S_relocate): New function that dispatches to _S_do_relocate based on _S_use_relocate. * include/bits/vector.tcc (vector::reserve, vector::_M_realloc_insert) (vector::_M_default_append): Call _S_relocate instead of __relocate_a. * testsuite/23_containers/vector/modifiers/push_back/89130.cc: New. From-SVN: r268537
* Fix after P0600.Ulrich Drepper2019-01-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/testsuite/ChangeLog 2019-02-20 Ulrich Drepper <drepper@redhat.com> Fix after P0600. * g++.dg/init/new39.C: Don't just ignore result of new. libstdc++/ChangeLog 2019-02-20 Ulrich Drepper <drepper@redhat.com> Implement C++20 P0600r1. * include/backward/hash_map: Add nodiscard attribute to empty. * include/backward/hash_set: Likewise. * backward/hashtable.h: Likewise. * include/bits/basic_string.h: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/hashtable.h: Likewise. * include/bits/regex.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/debug/array: Likewise. * include/experimental/any: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/internet: Likewise. * include/experimental/string_view: Likewise. * include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Likewise. * include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp: Likewise. * include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Likewise. * include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp: Likewise. * include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp: Likewise. * include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp: Likewise. * include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp: Likewise. * include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp: Likewise. * include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp: Likewise. * include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise. * include/ext/pb_ds/trie_policy.hpp: Likewise. * include/ext/rope: Likewise. * include/ext/slist: Likewise. * include/ext/vstring.h: Likewise. * include/profile/array: Likewise. * include/std/array: Likewise. * include/tr1/array: Likewise. * include/tr1/hashtable.h: Likewise. * include/tr1/regex: Likewise. * include/tr2/dynamic_bitset: Likewise. * include/bits/alloc_traits.h: Add nodiscard attribute to allocate. * include/experimental/memory_resource: Likewise. * include/ext/alloc_traits.h: Likewise. * include/ext/array_allocator.h: Likewise. * include/ext/bitmap_allocator.h: Likewise. * include/ext/debug_allocator.h: Likewise. * include/ext/extptr_allocator.h: Likewise. * include/ext/mt_allocator.h: Likewise. * include/ext/new_allocator.h: Likewise. * include/ext/pool_allocator.h: Likewise. * include/ext/throw_allocator.h: Likewise. * include/std/scoped_allocator: Likewise. * libsupc++/eh_alloc.cc: Likewise. * include/std/future: Add nodiscard attribute to async. * libsupc++/new: Add nodiscard attribute to new. From-SVN: r268111
* Update copyright years.Jakub Jelinek2019-01-011-1/+1
| | | | From-SVN: r267494
* Relocation (= move+destroy)Marc Glisse2018-10-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | 2018-10-25 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/87106 * include/bits/alloc_traits.h (_S_construct, _S_destroy, construct, destroy): Add noexcept specification. * include/bits/allocator.h (construct, destroy): Likewise. * include/ext/alloc_traits.h (construct, destroy): Likewise. * include/ext/malloc_allocator.h (construct, destroy): Likewise. * include/ext/new_allocator.h (construct, destroy): Likewise. * include/bits/stl_uninitialized.h (__relocate_object_a, __relocate_a, __relocate_a_1): New functions. (__is_trivially_relocatable): New class. * include/bits/stl_vector.h (__use_relocate): New static member. * include/bits/vector.tcc (reserve, _M_realloc_insert, _M_default_append): Use __relocate_a. (reserve, _M_assign_aux, _M_realloc_insert, _M_fill_insert, _M_default_append, _M_range_insert): Move _GLIBCXX_ASAN_ANNOTATE_REINIT after _Destroy. * testsuite/23_containers/vector/modifiers/push_back/49836.cc: Replace CopyConsOnlyType with DelAnyAssign. From-SVN: r265485
* Remove redundant #if conditionalJonathan Wakely2018-07-031-5/+2
| | | | | | | | | The whole file is guarded by the same check already. * include/bits/alloc_traits.h: Remove redundant preprocessor condition. From-SVN: r262359
* Update copyright years.Jakub Jelinek2018-01-031-1/+1
| | | | From-SVN: r256169
* Add C++17 deduction guide for std::basic_string (P0433R2, partial)Jonathan Wakely2017-06-071-0/+16
| | | | | | | | | | | | | | * include/bits/alloc_traits.h (__is_allocator, _RequireAllocator): New trait and alias for detecting Allocator-like types. * include/bits/basic_string.h (basic_string): Add deduction guide from P0433. * include/ext/alloc_traits.h (__gnu_cxx::__alloc_traits): Add template parameter with default template argument that causes substitution failures for types that cannot be allocators. * testsuite/21_strings/basic_string/cons/char/deduction.cc: New. * testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc: New. From-SVN: r248967
* PR72792 detect allocator pointer types without invalid rebindingJonathan Wakely2017-01-201-18/+37
| | | | | | | | | | | | | | | | | | PR libstdc++/72792 * include/bits/alloc_traits.h (__allocator_traits_base::__diff_type) (__allocator_traits_base::__size_type): Remove. (allocator_traits::_Ptr): New class template to detect const and void pointer types without instantiating pointer_traits::rebind unnecessarily. (allocator_traits::_Diff): Likewise for detecting difference_type. (allocator_traits::_Size): New class template to detect size_type without instantiating make_unsigned unnecessarily. * include/bits/ptr_traits.h (pointer_traits::element_type): Use __detected_or_t instead of __detected_or_t_. * include/std/type_traits (__detected_or_t_): Remove. * testsuite/20_util/allocator_traits/members/pointers.cc: New test. From-SVN: r244706
* PR72792 PR72793 relax requirements on rebind membersJonathan Wakely2017-01-201-8/+9
| | | | | | | | | | | | | | | | | | | PR libstdc++/72792 PR libstdc++/72793 * include/bits/alloc_traits.h (__allocator_traits_base::__rebind): Replace with class template using void_t. (__alloc_rebind): Define in terms of __allocator_traits_base::__rebind. (allocator_traits): Remove unconditional static_assert for rebind_alloc. * include/bits/ptr_traits.h (__replace_first_arg): Remove type member. (pointer_traits::__rebind): Replace with class template using void_t. (pointer_traits::rebind): Define in terms of __rebind. (pointer_traits): Remove unconditional static_assert for rebind. * testsuite/20_util/allocator_traits/members/rebind_alloc.cc: New test. * testsuite/20_util/pointer_traits/rebind.cc: New test. From-SVN: r244680
* Update copyright years.Jakub Jelinek2017-01-011-1/+1
| | | | From-SVN: r243994
* allocator_traits<allocator<T>> partial specializationJonathan Wakely2016-01-111-1/+128
| | | | | | | | | | PR libstdc++/60976 * include/bits/alloc_traits.h (allocator_traits<allocator<_Tp>>): Define partial specialization. * testsuite/20_util/shared_ptr/cons/58659.cc: Add construct and destroy members to std::allocator explicit specialization. From-SVN: r232232
* Update copyright years.Jakub Jelinek2016-01-041-1/+1
| | | | From-SVN: r232055
* alloc_traits.h: Add feature-test macro.Jonathan Wakely2015-08-131-0/+2
| | | | | | | | | | * include/bits/alloc_traits.h: Add feature-test macro. * include/bits/allocator.h: Likewise. * include/bits/range_access.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/unordered_map.h: Likewise. From-SVN: r226864
* alloc_traits.h (__alloctr_rebind): Remove.Jonathan Wakely2015-07-011-178/+82
| | | | | | | | | | | | | | | | * include/bits/alloc_traits.h (__alloctr_rebind): Remove. (__allocator_traits_base): New base class. (__alloc_rebind): Reimplement in terms of detection idiom. (allocator_traits): Derive from __allocator_traits_base. Reimplement nested types in terms of detection idiom. Simplify SFINAE constraints on overloaded static member functions. * include/bits/hashtable.h (_Hashtable): Use __alloc_rebind instead of __alloctr_rebind. * testsuite/20_util/scoped_allocator/propagation.cc: Define rebind. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust dg-error line number. From-SVN: r225244
* Implement N4258 (Cleaning-up noexcept in the Library rev 3)Jonathan Wakely2015-06-261-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/xml/manual/intro.xml: Document LWG 2108 status. * include/bits/alloc_traits.h (allocator_traits::is_always_equal): Define. * include/bits/allocator.h (allocator::is_always_equal): Likewise. * include/bits/forward_list.h (forward_list::operator=(forward_list&&)): Use __bool_constant. (forward_list::swap(forward_list&)): Add noexcept. * include/bits/hashtable.h (_Hashtable::operator=(_Hashtable&&)): Likewise. (_Hashtable::swap(_Hashtable&)): Likewise. * include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base&&)): Use _Alloc_traits::is_always_equal. (deque::operator=(deque&&)): Likewise. (deque::_M_move_assign1(deque&&, false_type)): Add comment and use __bool_constant. (swap(deque&, deque&)): Add noexcept. * include/bits/stl_list.h (list::operator=(list&&)): Use __bool_constant. (swap(list&, list&)): Add noexcept. * include/bits/stl_map.h (map::swap(map&)): Include _Compare in noexcept. (swap(map&, map&)): Add noexcept. * include/bits/stl_multimap.h (multimap::swap(multimap&)): Include _Compare in noexcept. (swap(multimap&, multimap&)): Add noexcept. * include/bits/stl_multiset.h (multiset::swap(multiset&)): Include _Compare in noexcept. (swap(multiset&, multiset&)): Add noexcept. * include/bits/stl_set.h (set::swap(set&)): Include _Compare in noexcept. (swap(set&, set&)): Add noexcept. * include/bits/stl_tree.h (_Rb_tree::operator=(_Rb_tree&&)): Include _Compare in noexcept. (_Rb_tree::_Rb_tree(_Rb_tree&&, _Node_alloc_type&&)): Use is_always_equal. * include/bits/stl_vector.h (vector::operator=(vector&&)): Use __bool_constant. (swap(vector&, vector&)): Add noexcept. * include/bits/unordered_map.h (swap(unordered_map&, unordered_map&), swap(unordered_multimap& unordered_multimap&)): Add noexcept. * include/bits/unordered_set.h (swap(unordered_set&, unordered_set&), swap(unordered_multiset& unordered_multiset&)): Add noexcept. * include/ext/alloc_traits.h (__allocator_always_compares_equal): Remove. (__alloc_traits::_S_always_equal()): Use is_always_equal instead of __allocator_always_compares_equal. * include/ext/array_allocator.h (array_allocator::is_always_equal): Define. * include/std/scoped_allocator (__any_of, __propagate_on_copy, __propagate_on_move, __propagate_on_swap): Remove. (scoped_allocator_adaptor::propagate_on_container_copy_assignment, scoped_allocator_adaptor::propagate_on_container_move_assignment, scoped_allocator_adaptor::propagate_on_container_swap): Define with __and_ instead of __any_of. (scoped_allocator_adaptor::is_always_equal): Define. * testsuite/20_util/allocator_traits/members/is_always_equal.cc: New. * testsuite/20_util/scoped_allocator/propagation.cc: Make traits derive from true_type or false_type. * testsuite/23_containers/deque/allocator/move_assign-2.cc: Add is_always_equal member and remove the trait specialization. * testsuite/23_containers/vector/52591.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Adjust dg-error line number. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. From-SVN: r225081
* alloc_traits.h (_S_max_size): Implement LWG 2466.Jonathan Wakely2015-05-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | * include/bits/alloc_traits.h (_S_max_size): Implement LWG 2466. * testsuite/20_util/allocator_traits/members/max_size.cc: Adjust. * testsuite/23_containers/forward_list/allocator/minimal.cc: Likewise. * testsuite/23_containers/map/allocator/minimal.cc: Likewise. * testsuite/23_containers/multimap/allocator/minimal.cc: Likewise. * testsuite/23_containers/multiset/allocator/minimal.cc: Likewise. * testsuite/23_containers/set/allocator/minimal.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/minimal.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: Likewise. * testsuite/23_containers/unordered_multiset/allocator/minimal.cc: Likewise. * testsuite/23_containers/unordered_set/allocator/minimal.cc: Likewise. * testsuite/util/testsuite_allocator.h: Remove unused parameter. From-SVN: r223154
* * include/bits/alloc_traits.h (__alloc_rebind): Change parameter name.Jonathan Wakely2015-05-011-2/+2
| | | | From-SVN: r222686
* Update copyright years.Jakub Jelinek2015-01-051-1/+1
| | | | From-SVN: r219188
* alloc_traits.h (__alloc_rebind): Define alias template.Jonathan Wakely2014-06-251-0/+3
| | | | | | | | | | * include/bits/alloc_traits.h (__alloc_rebind): Define alias template. * include/bits/forward_list.h (_Fwd_list_base): Use __alloc_rebind. * include/bits/hashtable_policy.h (_Insert_base, _Hashtable_alloc): Likewise. * include/ext/alloc_traits.h: Fix comment. From-SVN: r211995
* alloc_traits.h (allocator_traits::_S_allocate): Do not use varargs when ↵Jonathan Wakely2014-01-291-86/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument could be non-POD. * include/bits/alloc_traits.h (allocator_traits::_S_allocate): Do not use varargs when argument could be non-POD. (__alloctr_rebind_helper): Eliminate static const bool member by using true_type and false_type. (allocator_traits::__allocate_helper): Likewise. (allocator_traits::__construct_helper): Likewise. (allocator_traits::__destroy_helper): Likewise. (allocator_traits::__maxsize_helper): Likewise. (allocator_traits::__select_helper): Likewise. * include/bits/ptr_traits.h (__ptrtr_rebind_helper): Likewise. * include/bits/stl_tree.h (_Rb_tree::operator=(const _Rb_tree&)): Remove redundant condition. * include/bits/stl_vector.h (vector::operator=(const vector&)): Likewise. (_Vector_impl::_M_allocate, _Vector_impl::_M_deallocate): Use indirection through __alloc_traits. * include/ext/alloc_traits.h (__allocator_always_compares_equal): Eliminate static const bool members by using true_type and false_type. (__gnu_cxx::__alloc_traits::__is_custom_pointer): Optimize. * testsuite/util/testsuite_allocator.h (PointerBase): Define. * testsuite/20_util/allocator_traits/members/allocate_hint_nonpod.cc: New. * testsuite/20_util/allocator_traits/requirements/typedefs2.cc: New. From-SVN: r207240
* Update copyright years in libstdc++-v3/Richard Sandiford2014-01-021-1/+1
| | | | From-SVN: r206301
* alloc_traits.h (__allow_copy_cons): Remove.Jonathan Wakely2013-11-141-18/+0
| | | | | | | | | | | | | | | | | * include/bits/alloc_traits.h (__allow_copy_cons): Remove. (__check_copy_constructible): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): Do not derive from __check_copy_constructible. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/unordered_map/55043.cc: It is no longer necessary for is_copy_constructible to be correct to use nested unordered containers. * testsuite/23_containers/unordered_multimap/55043.cc: Likewise. * testsuite/23_containers/unordered_set/55043.cc: Likewise. * testsuite/23_containers/unordered_multiset/55043.cc: Likewise. From-SVN: r204790
* alloc_traits.h (allocator_traits::max_size()): LWG 2162: Add noexcept.Jonathan Wakely2013-06-081-1/+1
| | | | | | | * include/bits/alloc_traits.h (allocator_traits::max_size()): LWG 2162: Add noexcept. From-SVN: r199858
* memoryfwd.h: New.Benjamin Kosnik2013-03-081-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * include/bits/memoryfwd.h: New. Centralize forward declarations. * include/bits/algorithmfwd.h: Consistent comments. * include/bits/localefwd.h: Same. * include/ext/vstring_fwd.h: Same. * include/parallel/algorithmfwd.h: Same. * include/parallel/numericfwd.h: Same. * include/std/iosfwd: Same. * include/bits/alloc_traits.h: Include memoryfwd.h, remove allocator forward decl. * include/ext/alloc_traits.h: Remove allocator forward decl. * include/bits/stl_construct.h: Same. * include/bits/stringfwd.h: Include memoryfwd.h, remove allocator forward decl. Consistent comments. * doc/doxygen/user.cfg.in (TEMPLATE_RELATIONS): To NO. * include/Makefile.am (bits_headers): Add memoryfwd.h. * include/Makefile.in: Regenerate. * configure: Same. e enter the commit message for your changes. Lines starting From-SVN: r196559
* PR libstdc++/55043 (again)Jonathan Wakely2013-01-161-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | PR libstdc++/55043 (again) * include/bits/alloc_traits.h (allocator_traits::construct): Disable unless construction would be well-formed. (__allow_copy_cons, __check_copy_constructible): Define. * include/bits/unordered_map.h (__check_copy_constructible): Use as base class so copy constructor will be deleted if appropriate. (is_copy_constructible): Remove specialization. * include/bits/unordered_set.h: Likewise. * include/debug/unordered_map.h: Undo previous commit. Default copy and move constructors. * include/debug/unordered_set.h: Likewise. * include/profile/unordered_map.h: Undo previous commit. * include/profile/unordered_set.h: Likewise. * testsuite/23_containers/unordered_map/55043.cc: Fix test. * testsuite/23_containers/unordered_multimap/55043.cc: Likewise. * testsuite/23_containers/unordered_multiset/55043.cc: Likewise. * testsuite/23_containers/unordered_set/55043.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/53339.cc: XFAIL, cannot support incomplete types. * testsuite/23_containers/unordered_multimap/requirements/53339.cc: Likewise. From-SVN: r195253
* re PR libstdc++/55043 (issue with nesting unordered_map containing ↵Jonathan Wakely2013-01-161-1/+39
| | | | | | | | | | | | | | | | | | | | | | unique_ptr into vector) PR libstdc++/55043 * include/std/unordered_map: Include alloc_traits.h * include/std/unordered_set: Likewise. * include/bits/alloc_traits.h: Define __is_copy_insertable. * include/bits/unordered_map.h: Use it. * include/bits/unordered_set.h: Likewise. * include/debug/unordered_map.h: Likewise. * include/debug/unordered_set.h: Likewise. * include/profile/unordered_map.h: Likewise. * include/profile/unordered_set.h: Likewise. * include/bits/hashtable.h: Fix comment typos. * testsuite/23_containers/unordered_map/55043.cc: New. * testsuite/23_containers/unordered_multimap/55043.cc: New. * testsuite/23_containers/unordered_multiset/55043.cc: New. * testsuite/23_containers/unordered_set/55043.cc: New. From-SVN: r195231
* * many: Replace uses of __GXX_EXPERIMENTAL_CXX0X__ with __cplusplus.Jason Merrill2012-11-101-1/+1
| | | | From-SVN: r193392
* re PR libstdc++/53978 (Missing static const definitions in ↵Jonathan Wakely2012-07-161-1/+25
| | | | | | | | | | | | | <bits/alloc_traits.h>) PR libstdc++/53978 * include/bits/alloc_traits.h (allocator_traits): Define static constants. * include/bits/ptr_traits.h (pointer_traits): Likewise. * include/ext/alloc_traits.h (__allocator_always_compares_equal): Likewise. From-SVN: r189547
* ptr_traits.h (__rebind): Replace with...Jonathan Wakely2011-11-081-19/+4
| | | | | | | | | | | | | | | * include/bits/ptr_traits.h (__rebind): Replace with... (rebind): Implement using alias-declaration. * include/ext/pointer.h (__rebind): Replace with... (rebind): Implement using alias-declaration. * include/bits/alloc_traits.h (__rebind_alloc, __rebind_traits): Replace with... (rebind_alloc, rebind_traits): Implement using alias-declaration. * include/ext/alloc_traits.h (rebind): Use rebind_alloc instead of __rebind_alloc. * include/std/scoped_allocator (rebind): Likewise. From-SVN: r181139