Commit Graph

5478 Commits

Author SHA1 Message Date
Jonathan Wakely
3c040fa4a2 libstdc++/72745 add static assertion for invalid tuple access
PR libstdc++/72745
	* include/std/array (get): Use positive message for static assertions.
	* include/std/functional (_Safe_tuple_element_t): Fix indentation.
	* include/std/tuple (tuple_element<I, tuple<>>): Add partial
	specialization for invalid indices, with static assertion.
	* testsuite/20_util/tuple/element_access/get_neg.cc: New test.

From-SVN: r238924
2016-07-31 18:08:52 +01:00
Ville Voutilainen
8c9142276b Add missing variable traits, fix testsuite failures.
* include/bits/uses_allocator.h (uses_allocator_v): New.
	* include/std/functional (is_bind_expression_v, is_placeholder_v):
	Likewise.
	* testsuite/20_util/bind/is_placeholder_v.cc: Likewise.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
	* testsuite/20_util/duration/literals/range.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc:
	New.

From-SVN: r238921
2016-07-31 17:52:53 +03:00
Ville Voutilainen
137422c80c Implement C++17 variable templates for type traits.
* include/std/chrono (treat_as_floating_point_v): New.
	* include/std/ratio (ratio_equal_v, ratio_not_equal_v)
	(ratio_less_v, ratio_less_equal_v, ratio_greater_v)
	(ratio_greater_equal_v): Likewise.
	* include/std/system_error (is_error_code_enum_v)
	(is_error_condition_enum_v): Likewise.
	* include/std/tuple (tuple_size_v): Likewise.
	* type_traits (conjunction_v, disjunction_v, negation_v)
	(is_void_v, is_null_pointer_v, is_integral_v, is_floating_point_v)
	(is_array_v, is_pointer_v, is_lvalue_reference_v)
	(is_rvalue_reference_v, is_member_object_pointer_v)
	(is_member_function_pointer_v, is_enum_v, is_union_v)
	(is_class_v, is_function_v, is_reference_v, is_arithmetic_v)
	(is_fundamental_v, is_object_v, is_scalar_v, is_compound_v)
	(is_member_pointer_v, is_const_v, is_volatile_v, is_trivial_v)
	(is_trivially_copyable_v, is_standard_layout_v)
	(is_pod_v, is_literal_type_v, is_empty_v, is_polymorphic_v)
	(is_abstract_v, is_final_v, is_signed_v, is_unsigned_v)
	(is_constructible_v, is_default_constructible_v)
	(is_copy_constructible_v, is_move_constructible_v)
	(is_assignable_v, is_copy_assignable_v, is_move_assignable_v)
	(is_destructible_v, is_trivially_constructible_v)
	(is_trivially_default_constructible_v)
 	(is_trivially_copy_constructible_v, is_trivially_move_constructible_v)
	(is_trivially_assignable_v, is_trivially_copy_assignable_v)
	(is_trivially_move_assignable_v, is_trivially_destructible_v)
	(is_nothrow_constructible_v, is_nothrow_default_constructible_v)
	(is_nothrow_copy_constructible_v, is_nothrow_move_constructible_v)
	(is_nothrow_assignable_v, is_nothrow_copy_assignable_v)
	(is_nothrow_move_assignable_v, is_nothrow_destructible_v)
	(has_virtual_destructor_v, alignment_of_v, rank_v, extent_v)
	(is_same_v, is_base_of_v, is_convertible_v): Likewise.
	* testsuite/19_diagnostics/error_code/is_error_code_v.cc: Likewise.
	* testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc:
	Likewise.
	* testsuite/20_util/ratio/requirements/ratio_equal_v.cc: Likewise.
	* testsuite/20_util/tuple/tuple_size_v.cc: Likewise.
	* testsuite/20_util/variable_templates_for_traits.cc: Likewise.

From-SVN: r238892
2016-07-29 22:01:39 +03:00
Ville Voutilainen
ca8f2cb137 Implement std::string_view and P0254r2,
Integrating std::string_view and std::string.
	* include/Makefile.am: Add string_view and string_view.tcc
	to the exported headers.
	* include/Makefile.in: Likewise.
	* include/bits/basic_string.h: Include <string_view> in C++17 mode.
	(__sv_type): New.
	(basic_string(__sv_type, const _Alloc&)): Likewise.
	(operator=(__sv_type)): Likewise.
	(operator __sv_type()): Likewise.
	(operator+=(__sv_type)): Likewise.
	(append(__sv_type __sv)): Likewise.
	(append(__sv_type, size_type, size_type)): Likewise.
	(assign(__sv_type)): Likewise.
	(assign(__sv_type, size_type, size_type)): Likewise.
	(insert(size_type, __sv_type)): Likewise.
	(insert(size_type, __sv_type, size_type, size_type)): Likewise.
	(replace(size_type, size_type, __sv_type)): Likewise.
	(replace(size_type, size_type, __sv_type, size_type, size_type)):
	Likewise.
	(replace(const_iterator, const_iterator, __sv_type)): Likewise.
	(find(__sv_type, size_type)): Likewise.
	(rfind(__sv_type, size_type)): Likewise.
	(find_first_of(__sv_type, size_type)): Likewise.
	(find_last_of(__sv_type, size_type)): Likewise.
	(find_first_not_of(__sv_type, size_type)): Likewise.
	(find_last_not_of(__sv_type, size_type)): Likewise.
	(compare(__sv_type)): Likewise.
	(compare(size_type, size_type, __sv_type)): Likewise.
	(compare(size_type, size_type, __sv_type, size_type, size_type)):
	Likewise.
	* include/bits/string_view.tcc: New.
	* include/std/string_view: Likewise.
	* testsuite/21_strings/basic_string/cons/char/7.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/7.cc: Likewise.
	* testsuite/21_strings/basic_string/modifiers/append/char/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/append/wchar_t/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/assign/char/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/insert/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/replace/char/7.cc:
	Likewise.
	* testsuite/21_strings/basic_string/modifiers/replace/wchar_t/7.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/compare/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/find/char/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operations/find/wchar_t/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string/operators/char/5.cc: Likewise.
	* testsuite/21_strings/basic_string/operators/wchar_t/5.cc: Likewise.
	* testsuite/21_strings/basic_string_view/capacity/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/char/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/char/3.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/2.cc: Likewise.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/3.cc: Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/empty.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/char/front_back.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/empty.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/element_access/wchar_t/front_back.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/include.cc: Likewise.
	* testsuite/21_strings/basic_string_view/inserters/char/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/inserters/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string_view/inserters/char/3.cc: Likewise.
	* testsuite/21_strings/basic_string_view/inserters/pod/10081-out.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/13650.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/13650.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/data/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/data/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/4.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/string_conversion/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/substr/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/substr/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/range_access/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/requirements/typedefs.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/typedefs.cc: Likewise.
	* testsuite/21_strings/basic_string_view/types/1.cc: Likewise.

From-SVN: r238823
2016-07-28 18:15:26 +03:00
Georeth Chow
a837417c79 Fix missing qualification in <ext/rope>
2016-07-25  Georeth Chow  <georeth2010@gmail.com>

	* include/ext/ropeimpl.h (rope<>::_S_dump(_RopeRep*, int)): Qualify
	_S_concat enumerator.
	* testsuite/ext/rope/6.cc: New test.

From-SVN: r238711
2016-07-25 13:56:12 +01:00
Jonathan Wakely
8cab3d18f0 Move allocator in std::string and RB tree move constructors
PR libstdc++/71964
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_Alloc_hider(pointer, _Alloc&&)): Add constructor.
	* include/bits/stl_tree.h (_Rb_tree(_Rb_tree&&)): Move allocator.
	* testsuite/21_strings/basic_string/allocator/71964.cc: New test.
	* testsuite/23_containers/set/allocator/71964.cc: New test.

From-SVN: r238647
2016-07-22 16:03:11 +01:00
Jonathan Wakely
8b649cd3ba Fix naming, qualification and broken test for propagate_const
* include/experimental/propagate_const (propagate_const::__t): Rename
	to _M_t and remove comment. Qualify std::move and std::forward.
	* testsuite/experimental/propagate_const/cons/default.cc: Fix test.

From-SVN: r238611
2016-07-21 20:39:03 +01:00
Jonathan Wakely
e87b7d52c3 LWG 2441 Provide exact-width atomic typedefs
* include/std/atomic (atomic_int8_t, atomic_uint8_t, atomic_int16_t)
	(atomic_uint16_t, atomic_int32_t, atomic_uint32_t, atomic_int64_t)
	(atomic_uint64_t): Define (LWG 2441).
	* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc: Remove empty
	lines.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Test for
	the new types.
	* doc/xml/manual/intro.xml: Document DR 2441 status.

From-SVN: r238534
2016-07-20 19:21:59 +01:00
Jonathan Wakely
07c772ed4e LWG 2328 Rvalue stream extraction should use perfect forwarding
* include/std/istream (operator>>(basic_istream&&, _Tp&)): Adjust
	to use perfect forwarding (LWG 2328).
	* testsuite/27_io/rvalue_streams.cc: Test perfect forwarding.
	* doc/xml/manual/intro.xml: Document DR 2328 status.

From-SVN: r238533
2016-07-20 19:21:53 +01:00
Ville Voutilainen
40f3e91334 Clean up optional's comments.
From-SVN: r238436
2016-07-18 17:45:56 +03:00
Jonathan Wakely
4f5f9962c8 Replace references to C++0x with C++11 in comments
* include/bits/algorithmfwd.h: Change C++0x to C++11 in comments.
	* include/bits/move.h: Likewise.
	* include/bits/postypes.h: Likewise.
	* include/debug/bitset: Likewise.
	* include/ext/pb_ds/detail/type_utils.hpp: Likewise.
	* include/ext/string_conversions.h: Change C++0x to __cxx11 in
	comment.
	* testsuite/27_io/fpos/14320-1.cc: Change C++0x to C++11 in comment.
	* testsuite/util/thread/all.h: Likewise.

From-SVN: r238402
2016-07-15 21:23:08 +01:00
Jonathan Wakely
d1129d45b0 Remove redundant std::move in std::for_each
* include/bits/stl_algo.h (for_each): Remove redundant _GLIBCXX_MOVE
	and adjust comment.

From-SVN: r238399
2016-07-15 20:51:33 +01:00
Edward Smith-Rowland
4db1cb44be Implement C++17 P0025 clamp.
2016-07-15  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement C++17 P0025 clamp.
	* include/bits/algorithmfwd.h: Declare clamp overloads.
	* include/bits/stl_algo.h: Implement clamp.  Feature __cpp_lib_clamp.
	* testsuite/25_algorithms/clamp/1.cc: New test.
	* testsuite/25_algorithms/clamp/2.cc: New test.
	* testsuite/25_algorithms/clamp/constexpr.cc: New test.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/
	1.cc: New test.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/
	pod.cc: New test.

From-SVN: r238383
2016-07-15 17:16:32 +00:00
Ville Voutilainen
1ec0f76305 Fix the constraints for any's assignment operator template to properly
reject assignment from a non-copyable lvalue.

From-SVN: r238365
2016-07-15 10:44:22 +03:00
Jonathan Wakely
ea5ec6b7e0 Include header for std::__parallel::search
* include/experimental/functional: Include <parallel/algorithm> in
	Parallel Mode.

From-SVN: r238342
2016-07-14 16:43:17 +01:00
Jonathan Wakely
0a2bf18874 Improve doxygen comments for allocators in containers
PR libstdc++/70716
	* include/bits/forward_list.h (forward_list): Update doxygen comments
	to reflect allocator propagation semantics. Remove ambiguous
	statements about data being lost.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_map.h (map): Likewise.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/bits/unordered_map.h (unordered_map, unordered_multimap):
	Likewise.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Likewise.

From-SVN: r238332
2016-07-14 11:02:10 +01:00
Ville Voutilainen
25a69162c9 Implement P0032R3, Homogeneous interface for variant, any and optional,
for the parts concerning any and optional.
	* include/std/any (_Storage()): Make constexpr and have it
	initialize _M_ptr.
	(any()): Make constexpr.
	(any(const any&)): Adjust.
	(any(any&&)): Likewise.
	(__any_constructible_t): New.
	(any(_ValueType&&)): Constrain.
	(any(in_place_type_t<_Tp>, _Args&&...)): New.
	(any(in_place_type_t<_Tp>, initializer_list<_Up>, _Args&&...)):
	Likewise.
	(~any()): Adjust.
	(operator=(const any&)): Likewise.
	(operator=(any&&)): Likewise.
	(operator=(_ValueType&&)): Constrain.
	(emplace(_Args&&...)): New.
	(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
	(clear()): Remove.
	(reset()): New.
	(swap(any&)): Adjust.
	(empty()): Remove.
	(has_value()): New.
	(type()): Adjust.
	(_Manager_internal::_S_create(_Storage&, _Args&&...)): New.
	(_Manager_external::_S_create(_Storage&, _Args&&...)): Likewise.
	(make_any(_Args&&...)): Likewise.
	(make_any(initializer_list<_Up>, _Args&&...)): Likewise.
	* include/std/optional (in_place_t, in_place): Remove.
	(bad_optional_access): Add a comment referring to LEWG 72.
	(emplace(_Args&&...)): Constrain.
	(has_value()): New.
	(reset()): Likewise.
	(make_optional(_Args&&...)): Likewise.
	(make_optional(initializer_list<_Up>, _Args&&...)): Likewise.
	* include/std/utility (in_place_tag): New.
	(__in_place, __in_place_type, __in_place_index): Likewise.
	(in_place_t, in_place_type_t, in_place_index_t): Likewise.
	(in_place(__in_place*)): Likewise.
	(in_place(__in_place_type<_Tp>*)): Likewise.
	(in_place(__in_place_index<_Idx>*)): Likewise.
	* testsuite/20_util/any/assign/1.cc: Adjust.
	* testsuite/20_util/any/assign/emplace.cc: New.
	* testsuite/20_util/any/assign/self.cc: Adjust.
	* testsuite/20_util/any/cons/1.cc: Likewise.
	* testsuite/20_util/any/cons/in_place.cc: New.
	* testsuite/20_util/any/make_any.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.
	* testsuite/20_util/any/misc/swap.cc: Likewise.
	* testsuite/20_util/any/modifiers/1.cc: Likewise.
	* testsuite/20_util/any/requirements.cc: New.
	* testsuite/20_util/in_place/requirements.cc: Likewise.
	* testsuite/20_util/optional/constexpr/in_place.cc: Adjust.
	* testsuite/20_util/optional/in_place.cc: Likewise.
	* testsuite/20_util/optional/make_optional.cc: Add tests for
	the new overloads of make_optional.

From-SVN: r238329
2016-07-14 12:10:05 +03:00
Jonathan Wakely
e383deac8b libstdc++/71856 Define _GLIBCXX_PARALLEL_ASSERTIONS
PR libstdc++/71856
	* include/bits/c++config (_GLIBCXX_ASSERTIONS): Define to 1 not empty.
	* include/parallel/compiletime_settings.h (_GLIBCXX_ASSERTIONS):
	Rename to _GLIBCXX_PARALLEL_ASSERTIONS and make default value depend
	on _GLIBCXX_ASSERTIONS.
	* include/parallel/balanced_quicksort.h: Rename _GLIBCXX_ASSERTIONS.
	Include <unistd.h> for sleep.
	* include/parallel/losertree.h: Rename _GLIBCXX_ASSERTIONS.
	* include/parallel/merge.h: Likewise.
	* include/parallel/multiway_merge.h: Likewise.
	* include/parallel/partition.h: Likewise.
	* include/parallel/queue.h: Likewise.
	* include/parallel/sort.h: Likewise.
	* testsuite/25_algorithms/headers/algorithm/
	parallel_algorithm_assert.cc: New.

From-SVN: r238307
2016-07-13 18:22:57 +01:00
Jonathan Wakely
17f8dc9367 Make basic_string::replace forward to different overload
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(replace(__const_iterator, __const_iterator, initializer_list<C>)):
	Forward to different overload.

From-SVN: r238306
2016-07-13 18:22:51 +01:00
Jonathan Wakely
260d92cd0d Make __allocated_ptr::_S_raw_ptr static
* include/bits/allocated_ptr.h (__allocated_ptr::_S_raw_ptr): Make
	static.

From-SVN: r238305
2016-07-13 18:22:47 +01:00
Jonathan Wakely
2d60da1031 Revert "Add non-const overload of std::string::data()"
This reverts r238291 aka 4300aa2087d90cd2d55852fa38f082a89bc7e72d.

From-SVN: r238303
2016-07-13 16:56:46 +01:00
Ville Voutilainen
86c0ec1de1 Implement P0307R2, Making Optional Greater Equal Again.
* include/experimental/optional (_Has_addressof): Fix the comment.
	* include/std/optional (_Has_addressof): Likewise.
	(operator=(_Up&&)): Constrain.
	(operator=(const optional<_Up>&)): Likewise.
	(operator=(optional<_Up>&&)): Likewise.
	(__optional_relop_t): New.
	(operator==(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
	(operator!=(const optional<_Tp>&, const optional<_Tp>&)):
	Constrain and make transparent.
	(operator<(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
	(operator>(const optional<_Tp>&, const optional<_Tp>&)):
	Constrain and make transparent.
	(operator<=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
	(operator>=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
	(operator==(const optional<_Tp>&, const _Tp&): Constrain.
	(operator==(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator!=(const optional<_Tp>&, _Tp const&)):
	Constrain and make transparent.
	(operator!=(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator<(const optional<_Tp>&, const _Tp&)): Constrain.
	(operator<(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator>(const optional<_Tp>&, const _Tp&)):
	Constrain and make transparent.
	(operator>(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator<=(const optional<_Tp>&, const _Tp&)): Likewise.
	(operator<=(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator>=(const optional<_Tp>&, const _Tp&)): Likewise.
	(operator>=(const _Tp&, const optional<_Tp>&)): Likewise.
	* testsuite/20_util/optional/constexpr/relops/2.cc: Adjust.
	* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/20_util/optional/relops/1.cc: Likewise.
	* testsuite/20_util/optional/relops/2.cc: Likewise.
	* testsuite/20_util/optional/relops/3.cc: Likewise.
	* testsuite/20_util/optional/relops/4.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Add tests to verify
	that optional's relops are transparent and don't synthesize
	operators. Also test that assignment sfinaes.

From-SVN: r238292
2016-07-13 14:25:51 +03:00
Jonathan Wakely
ceea48fc64 Add non-const overload of std::string::data()
Also fix confusion between pointer and _CharT*, so that allocators with
fancy pointers work correctly.

	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (_M_c_str):
	New function.
	(_M_disjunct, basic_string(const basic_string&, size_t)): Use data()
	instead of _M_data().
	(basic_string(const basic_string&, size_t, size_t, const _Alloc&)):
	Likewise.
	(append(const basic_string&)): Likewise.
	(append(const basic_string&, size_type, size_type)): Likewise.
	(assign(const basic_string&, size_type, size_type)): Likewise.
	(insert(size_type, const basic_string&)): Likewise.
	(insert(size_type, const basic_string&, size_type, size_type)):
	Likewise.
	(replace(size_type, size_type, const basic_string&, size_type,
	size_type)): Likewise.
	(replace(__const_iterator, __const_iterator, const basic_string&)):
	Likewise.
	(c_str(), data()): Use c_str() instead of _M_data().
	(data()): Add non-const overload as per LWG 2391 and P0272R1.
	(compare(const basic_string&)): Use data() instead of _M_data().
	[!_GLIBCXX_USE_CXX11_ABI] (data()): Add non-const overload.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI] (_M_mutate):
	Pass raw pointers to _S_copy.
	(_M_erase, _M_replace_aux): Pass raw pointers to _S_move and
	_S_assign.
	(find(const _CharT*, size_type, size_type)): Use data instead of
	_M_data().
	* testsuite/21_strings/basic_string/allocator/char/ext_ptr.cc: New.
	* testsuite/21_strings/basic_string/operations/data/char/2.cc: New.
	* testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc: New.

From-SVN: r238291
2016-07-13 12:08:37 +01:00
François Dumont
76225d2ca7 stl_vector.h (push_back(const value_type&)): Forward to _M_realloc_insert.
2016-07-11  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_vector.h (push_back(const value_type&)): Forward
	to _M_realloc_insert.
	(insert(const_iterator, value_type&&)): Forward to _M_insert_rval.
	(_M_realloc_insert): Declare new function.
	(_M_emplace_back_aux): Remove definition.
	* include/bits/vector.tcc (emplace_back(_Args...)):
	Use _M_realloc_insert.
	(insert(const_iterator, const value_type&)): Likewise.
	(_M_insert_rval, _M_emplace_aux): Likewise.
	(_M_emplace_back_aux): Remove declaration.
	(_M_realloc_insert): Define.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
	Adjust expected results for emplacing an lvalue with reallocation.

From-SVN: r238226
2016-07-11 20:17:56 +00:00
Ville Voutilainen
435e56fb52 Implement std::optional.
* include/Makefile.am: Add optional to exported headers.
	* include/Makefile.in: Likewise.
	* include/std/optional: New.
	* testsuite/20_util/optional/typedefs.cc: Likewise.
	* testsuite/20_util/optional/relops/2.cc: Likewise.
	* testsuite/20_util/optional/relops/3.cc: Likewise.
	* testsuite/20_util/optional/relops/4.cc: Likewise.
	* testsuite/20_util/optional/relops/5.cc: Likewise.
	* testsuite/20_util/optional/relops/1.cc: Likewise.
	* testsuite/20_util/optional/relops/6.cc: Likewise.
	* testsuite/20_util/optional/nullopt.cc: Likewise.
	* testsuite/20_util/optional/in_place.cc: Likewise.
	* testsuite/20_util/optional/make_optional.cc: Likewise.
	* testsuite/20_util/optional/assignment/2.cc: Likewise.
	* testsuite/20_util/optional/assignment/3.cc: Likewise.
	* testsuite/20_util/optional/assignment/4.cc: Likewise.
	* testsuite/20_util/optional/assignment/5.cc: Likewise.
	* testsuite/20_util/optional/assignment/1.cc: Likewise.
	* testsuite/20_util/optional/assignment/6.cc: Likewise.
	* testsuite/20_util/optional/cons/value_neg.cc: Likewise.
	* testsuite/20_util/optional/cons/default.cc: Likewise.
	* testsuite/20_util/optional/cons/move.cc: Likewise.
	* testsuite/20_util/optional/cons/value.cc: Likewise.
	* testsuite/20_util/optional/cons/copy.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Likewise.
	* testsuite/20_util/optional/observers/2.cc: Likewise.
	* testsuite/20_util/optional/observers/3.cc: Likewise.
	* testsuite/20_util/optional/observers/4.cc: Likewise.
	* testsuite/20_util/optional/observers/5.cc: Likewise.
	* testsuite/20_util/optional/observers/1.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/3.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/5.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/1.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/6.cc: Likewise.
	* testsuite/20_util/optional/constexpr/nullopt.cc: Likewise.
	* testsuite/20_util/optional/constexpr/in_place.cc: Likewise.
	* testsuite/20_util/optional/constexpr/make_optional.cc: Likewise.
	* testsuite/20_util/optional/constexpr/cons/default.cc: Likewise.
	* testsuite/20_util/optional/constexpr/cons/value.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/3.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/4.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/5.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/1.cc: Likewise.
	* testsuite/20_util/optional/swap/1.cc: Likewise.

From-SVN: r238197
2016-07-10 20:44:21 +03:00
Ville Voutilainen
52e8622199 Implement std::any.
* include/Makefile.am: Add any and c++17_warning.h to exported headers.
	* include/Makefile.in: Likewise.
	* include/std/any: New.
	* testsuite/20_util/any/assign/1.cc: Likewise.
	* testsuite/20_util/any/assign/2.cc: Likewise.
	* testsuite/20_util/any/assign/self.cc: Likewise.
	* testsuite/20_util/any/cons/1.cc: Likewise.
	* testsuite/20_util/any/cons/2.cc: Likewise.
	* testsuite/20_util/any/cons/aligned.cc: Likewise.
	* testsuite/20_util/any/cons/nontrivial.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Likewise.
	* testsuite/20_util/any/misc/any_cast_no_rtti.cc: Likewise.
	* testsuite/20_util/any/misc/swap.cc: Likewise.
	* testsuite/20_util/any/modifiers/1.cc: Likewise.
	* testsuite/20_util/any/observers/type.cc: Likewise.
	* testsuite/20_util/any/typedefs.cc: Likewise.

From-SVN: r238061
2016-07-07 01:33:20 +03:00
Ville Voutilainen
3042e70851 Add a new header for diagnosing the use of C++17 facilities in pre-C++17 modes.
From-SVN: r238058
2016-07-06 21:07:57 +03:00
Ville Voutilainen
6ffe854859 Implement LWG 2451, optional<T> should 'forward' T's implicit conversions.
Implement LWG 2451, optional<T> should 'forward' T's
	implicit conversions.
	* include/experimental/optional (__is_optional_impl, __is_optional):
	New.
	(optional()): Make constexpr and default.
	(optional(_Up&&), optional(const optional<_Up>&),
	optional(optional<_Up>&& __t): New.
	(operator=(_Up&&)): Constrain.
	(operator=(const optional<_Up>&), operator=(optional<_Up>&&)): New.
	* testsuite/experimental/optional/cons/value.cc:
	Add tests for the functionality added by LWG 2451.
	* testsuite/experimental/optional/cons/value_neg.cc: New.

From-SVN: r238049
2016-07-06 16:26:10 +03:00
Ville Voutilainen
7d4f48b5b8 Implement LWG 2509,
any_cast doesn't work with rvalue reference targets and cannot
	move with a value target.
	* include/experimental/any (any(_ValueType&&)): Constrain and
	add an overload that doesn't forward.
	(any_cast(any&&)): Constrain and add an overload that moves.
	* testsuite/experimental/any/misc/any_cast.cc: Add tests for
	the functionality added by LWG 2509.

From-SVN: r238022
2016-07-05 21:33:18 +03:00
Jonathan Wakely
9958c7eb58 Fix std::vector's use of temporary objects
* include/bits/stl_vector.h (emplace(const_iterator, _Args&&...)):
	Define inline. Forward to _M_emplace_aux.
	(insert(const_iterator, value_type&&)): Forward to _M_insert_rval.
	(_M_insert_rval, _M_emplace_aux): Declare new functions.
	(_Temporary_value): New RAII type using allocator to construct/destroy.
	(_S_insert_aux_assign): Remove.
	(_M_insert_aux): Make non-variadic.
	* include/bits/vector.tcc (insert(const_iterator, const value_type&)):
	Use _Temporary_value.
	(emplace(const_iterator, _Args&&...)): Remove definition.
	(_M_insert_rval, _M_emplace_aux): Define.
	(_M_insert_aux): Make non-variadic, stop using _S_insert_aux_assign.
	(_M_fill_insert): Use _Temporary_value.
	* testsuite/23_containers/vector/allocator/construction.cc: New test.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
	Adjust expected results for emplacing an lvalue with reallocation.
	* testsuite/23_containers/vector/check_construct_destroy.cc: Adjust
	expected results to account for construction/destruction of temporary
	using allocator.

From-SVN: r237985
2016-07-04 15:52:46 +01:00
François Dumont
dc448fa03b re PR libstdc++/71640 (include/c++/7.0.0/bits/hashtable.h:293:7: error: too many template parameters in template redeclaration)
2016-06-27  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/71640
	* include/bits/hashtable.h: Remove _Unique_keya parameter in _Insert
	friend declaration.

From-SVN: r237803
2016-06-27 20:41:59 +00:00
François Dumont
e615c24c30 array (array<>::swap): Fix noexcept qualificaton for zero-size array.
2016-06-23  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/array (array<>::swap): Fix noexcept qualificaton for
	zero-size array.

From-SVN: r237747
2016-06-23 20:21:47 +00:00
François Dumont
29dbb034cb re PR libstdc++/71181 (Reserving in unordered_map doesn't reserve enough)
2016-06-20  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/71181
	* include/tr1/hashtable_policy.h
	(_Prime_rehash_policy::_M_next_bkt): Make past-the-end iterator
	dereferenceable to avoid check on lower_bound result.
	(_Prime_rehash_policy::_M_bkt_for_elements): Call latter.
	(_Prime_rehash_policy::_M_need_rehash): Likewise.
	* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
	Always return a value greater than input value. Set _M_next_resize to
	max value when reaching highest prime number.
	* src/shared/hashtable-aux.cc (__prime_list): Add comment about sentinel
	being now useless.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc: New.
	* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc
	(test02): New.
	* testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc: New.
	* testsuite/23_containers/unordered_set/hash_policy/rehash.cc:
	Fix indentation.

From-SVN: r237617
2016-06-20 20:04:25 +00:00
Jonathan Wakely
3ebacabd0e libstdc++/71545 fix debug checks in binary search algorithms
PR libstdc++/71545
	* include/bits/stl_algobase.h (lower_bound, lexicographical_compare):
	Remove irreflexive checks.
	* include/bits/stl_algo.h (lower_bound, upper_bound, equal_range,
	binary_search): Likewise.
	* testsuite/25_algorithms/equal_range/partitioned.cc: New test.
	* testsuite/25_algorithms/lexicographical_compare/71545.cc: New test.
	* testsuite/25_algorithms/lower_bound/partitioned.cc: New test.
	* testsuite/25_algorithms/upper_bound/partitioned.cc: New test.
	* testsuite/util/testsuite_iterators.h (__gnu_test::test_container):
	Add constructor from array.

From-SVN: r237560
2016-06-17 19:28:34 +01:00
François Dumont
bd2ee798d5 2016-06-16 François Dumont <fdumont@gcc.gnu.org>
* include/debug/debug.h
	(__glibcxx_requires_non_empty_range, __glibcxx_requires_nonempty)
	(__glibcxx_requires_subscript): Move...
	* include/debug/assertions.h: ...here and add __builtin_expect.
	(_GLIBCXX_DEBUG_ONLY): Remove ; value.
	* include/bits/stl_deque.h
	(std::deque<>::operator[]): Add __glibcxx_requires_subscript check.
	(std::deque<>::front()): Add __glibcxx_requires_nonempty check.
	(std::deque<>::back()): Likewise.
	(std::deque<>::pop_front()): Likewise.
	(std::deque<>::pop_back()): Likewise.
	(std::deque<>::swap(deque&)): Add allocator check.
	* include/bits/stl_vector.h
	(std::vector<>::operator[]): Add __glibcxx_requires_subscript check.
	(std::vector<>::front()): Add __glibcxx_requires_nonempty check.
	(std::vector<>::back()): Likewise.
	(std::vector<>::pop_back()): Likewise.
	(std::vector<>::swap(vector&)): Add allocator check.

From-SVN: r237541
2016-06-16 20:34:08 +00:00
Daniel Kruegler
6b9539e2aa Provide swappable traits (p0185r1)
2016-06-16  Daniel Kruegler  <daniel.kruegler@gmail.com>

	Provide swappable traits (p0185r1)
	* include/std/type_traits (is_swappable, is_nothrow_swappable,
	is_swappable_with, is_nothrow_swappable_with, is_swappable_v,
	is_nothrow_swappable_v, is_swappable_with_v,
	is_nothrow_swappable_with_v): New.
	* include/bits/stl_pair.h: Use it as per p0185r1.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/std/tuple: Likewise.
	* include/std/array: Likewise. Fix zero-size member swap.
	* include/bits/hashtable.h: Use __and_.
	* testsuite/20_util/is_nothrow_swappable/requirements/
	explicit_instantiation.cc: Change test options to std=gnu++17.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/value.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_swappable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/
	explicit_instantiation_ext.cc: New.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs_ext.cc:
	New.
	* testsuite/20_util/is_nothrow_swappable/value.h: New.
	* testsuite/20_util/is_nothrow_swappable/value_ext.cc: New.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc:
	New.
	* testsuite/20_util/is_nothrow_swappable_with/value.cc: New.
	* testsuite/20_util/is_swappable/requirements/
	explicit_instantiation_ext.cc: New.
	* testsuite/20_util/is_swappable/requirements/typedefs_ext.cc: New.
	* testsuite/20_util/is_swappable/value.h: New.
	* testsuite/20_util/is_swappable/value_ext.cc: New.
	* testsuite/20_util/is_swappable_with/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_swappable_with/requirements/typedefs.cc: New.
	* testsuite/20_util/is_swappable_with/value.cc: New.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
	dg-error line numbers.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Likewise.

From-SVN: r237531
2016-06-16 16:07:19 +01:00
Jonathan Wakely
33ac58d529 Remove trailing whitespace from libstdc++ headers
* include/std/array: Remove trailing whitespace.
	* include/std/atomic: Likewise.
	* include/std/bitset: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/fstream: Likewise.
	* include/std/functional: Likewise.
	* include/std/future: Likewise.
	* include/std/iomanip: Likewise.
	* include/std/iosfwd: Likewise.
	* include/std/istream: Likewise.
	* include/std/limits: Likewise.
	* include/std/ratio: Likewise.
	* include/std/scoped_allocator: Likewise.
	* include/std/sstream: Likewise.
	* include/std/stdexcept: Likewise.
	* include/std/string: Likewise.
	* include/std/system_error: Likewise.
	* include/std/thread: Likewise.
	* include/std/tuple: Likewise.
	* include/std/type_traits: Likewise.
	* include/std/utility: Likewise.
	* include/std/valarray: Likewise.
	* include/std/vector: Likewise.

From-SVN: r237528
2016-06-16 14:47:35 +01:00
Jonathan Wakely
0ae207e947 Optimize inserting value_type into std::vector
* include/bits/stl_vector.h (vector::_S_insert_aux_assign): Define
	new overloaded functions.
	* include/bits/vector.tcc (vector::_M_insert_aux): Use new functions
	to avoid creating a redundant temporary.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc: New
	test.

From-SVN: r237526
2016-06-16 13:42:21 +01:00
François Dumont
d7e16fc536 2016-06-15 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_deque.h
	(std::deque<>::operator=): Call _M_assign_aux.
	(std::deque<>::assign(initializer_list<>)): Likewise.
	(std::deque<>::resize(size_t, const value_type&)): Call _M_fill_insert.
	(std::deque<>::insert(const_iterator, initializer_list<>)):
	Call _M_range_insert_aux.
	(std::deque<>::_M_assign_aux<It>(It, It, std::forward_iterator_tag):
	Likewise.
	(std::deque<>::_M_fill_assign): Call _M_fill_insert.
	(std::deque<>::_M_move_assign2): Call _M_assign_aux.
	* include/bits/deque.tcc
	(std::deque<>::operator=): Call _M_range_insert_aux.
	(std::deque<>::_M_assign_aux<It>(It, It, std::input_iterator_tag)):
	Likewise.
	* include/bits/stl_vector.h
	(std::vector<>::operator=): Call _M_assign_aux.
	(std::vector<>::assign(initializer_list<>)): Likewise.
	(std::vector<>::resize(size_t, const value_type&)): Call _M_fill_insert.
	(std::vector<>::insert(const_iterator, initializer_list<>)):
	Call _M_range_insert.
	* include/bits/vector.tcc (std::vector<>::_M_assign_aux): Likewise.

From-SVN: r237495
2016-06-15 20:09:56 +00:00
François Dumont
373c00952c tuple (_Head_base<>): Default specialization condition at type declaration.
2016-06-07  François Dumont  <fdumont@gcc.gnu.org>

	* include/std/tuple (_Head_base<>): Default specialization condition at
	type declaration.

From-SVN: r237184
2016-06-07 20:19:19 +00:00
Ville Voutilainen
dbc6221fe5 Support allocators in tuples of zero size.
* include/std/tuple (tuple<>::tuple(),
	tuple<>::tuple(allocator_arg_t, const _Alloc&),
	tuple<>::tuple(allocator_arg_t, const _Alloc&, const tuple&)): New.
	* testsuite/20_util/tuple/cons/allocators.cc: Adjust.

From-SVN: r237143
2016-06-06 19:28:59 +03:00
Ville Voutilainen
7a66745357 Protect allocator-overloads of tuple-from-tuple constructors from cases that would create dangling references.
Protect allocator-overloads of tuple-from-tuple constructors
	from cases that would create dangling references.
	* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
 	const tuple<_UElements...>&), tuple(allocator_arg_t, const _Alloc&,
 	tuple<_UElements...>&&)): Add a check for _NonNestedTuple.
	* testsuite/20_util/tuple/cons/nested_tuple_construct.cc: Adjust.

From-SVN: r237106
2016-06-05 20:39:10 +03:00
Ville Voutilainen
48035dfbea Fix build.
From-SVN: r236823
2016-05-27 17:34:08 +03:00
Ville Voutilainen
b702100693 re PR libstdc++/66338 (std::forward_as_tuple() issue with single argument)
2016-05-24  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR libstdc++/66338
	* include/std/tuple (_TMC): Add a check for _NotSameTuple.
	* include/std/tuple (tuple(_UElements&&...)): Remove the separate
	check for _NotSameTuple.
	* include/std/tuple (_TMCT): New.
	* include/std/tuple (tuple(const tuple<_UElements...>&)): Use it.
	* include/std/tuple (tuple(tuple<_UElements...>&&)): Likewise.
	* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
	      const tuple<_UElements...>&)): Likewise.
	* include/std/tuple (tuple(allocator_arg_t, const _Alloc&,
	      tuple<_UElements...>&&)): Likewise.
	* testsuite/20_util/tuple/cons/66338.cc: New.

From-SVN: r236822
2016-05-27 17:08:37 +03:00
Jonathan Wakely
834f4c4355 Remove _GLIBCXX14_USE_CONSTEXPR
* include/bits/c++config (_GLIBCXX14_USE_CONSTEXPR): Remove it.
	* include/bits/hashtable_policy.h (_Power2_rehash_policy::_M_next_bkt):
	Remove const qualification on function. Replace
	_GLIBCXX14_USE_CONSTEXPR on automatic variables with const.
	(_Power2_rehash_policy::_M_need_rehash): Remove const qualification.
	(_Power2_rehash_policy::_M_next_bkt): Remove mutable specifier.

From-SVN: r236697
2016-05-25 10:36:28 +01:00
François Dumont
732eb07625 c++config (_GLIBCXX14_USE_CONSTEXPR): New.
2016-05-24  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/c++config (_GLIBCXX14_USE_CONSTEXPR): New.
	* include/bits/hashtable_policy.h
	(_Prime_rehash_policy::__has_load_factor): New. Mark rehash policy
	having load factor management.
	(_Mask_range_hashing): New.
	(__clp2): New.
	(_Power2_rehash_policy): New.
	(_Inserts<>): Remove last template parameter, _Unique_keys, so that
	partial specializations only depend on whether iterators are constant
	or not.
	* testsuite/23_containers/unordered_set/hash_policy/26132.cc: Adapt to
	test new hash policy.
	* testsuite/23_containers/unordered_set/hash_policy/load_factor.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/hash_policy/rehash.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/insert/hash_policy.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/max_load_factor/robustness.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc:
	New.
	* testsuite/performance/23_containers/insert/54075.cc: Add benchmark
	using the new hash policy.
	* testsuite/performance/23_containers/insert_erase/41975.cc: Likewise.

From-SVN: r236669
2016-05-24 20:55:57 +00:00
Jonathan Wakely
8be062c6da Add priority_queue::value_compare (LWG 2684)
* include/bits/stl_queue.h (priority_queue::value_compare): Define.

From-SVN: r236646
2016-05-24 16:59:05 +01:00
François Dumont
447caf82a4 2016-05-23 François Dumont <fdumont@gcc.gnu.org>
* include/debug/safe_iterator.h
	(_Safe_iterator<>::operator->()): Implement using underlying iterator
	operator ->.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<>::operator->()): Likewise.

From-SVN: r236611
2016-05-23 20:03:35 +00:00
Jonathan Wakely
541a9b104b libstdc++/71073 add system_header pragma to Debug Mode headers
PR libstdc++/71073
	* include/debug/bitset: Add #pragma GCC system_header.
	* include/debug/deque: Likewise.
	* include/debug/list: Likewise.
	* include/debug/map: Likewise.
	* include/debug/set: Likewise.
	* include/debug/string: Likewise.
	* include/debug/unordered_map: Likewise.
	* include/debug/unordered_set: Likewise.
	* include/debug/vector: Likewise.
	* include/debug/functions.h: Adjust whitespace.

From-SVN: r236211
2016-05-13 15:47:46 +01:00
Jonathan Wakely
7f99d40a99 Test begin and end functions for directory iterators
* include/experimental/bits/fs_dir.h (begin, end): Add noexcept.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Test begin and end functions.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r236085
2016-05-10 16:39:20 +01:00