Commit Graph

3199 Commits

Author SHA1 Message Date
François Dumont
3157879227 re PR libstdc++/54296 (using the object in the map to erase element from the map crashes)
2012-09-05  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/54296
	* include/bits/hashtable.h (_M_erase(size_type, __node_base*,
	__node_type*)): New.
	(erase(const_iterator)): Use latter.
	(_M_erase(std::true_type, const key_type&)): New, likewise.
	(_M_erase(std::false_type, const key_type&)): New. Find all nodes
	matching the key before deallocating them so that the key doesn't
	get invalidated.
	(erase(const key_type&)): Use the new member functions.
	* testsuite/23_containers/unordered_map/erase/54296.cc: New.
	* testsuite/23_containers/unordered_multimap/erase/54296.cc: New.

From-SVN: r190991
2012-09-05 19:41:16 +00:00
Benjamin Kosnik
3e7e2f128b PR libstdc++/54005 continued
2012-08-30  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/54005 continued
	* include/std/atomic: Use __atomic_lock_free with
	* include/bits/atomic_base.h: Same.

From-SVN: r190810
2012-08-30 19:24:58 +00:00
Ulrich Drepper
25270f5e5a random.h (random_device): Remove 'return' from constructor.
* include/bits/random.h (random_device) [GLIBCXX_USE_RANDOM_TR1]:
	Remove 'return' from constructor.

From-SVN: r190806
2012-08-30 16:33:09 +00:00
Ulrich Drepper
a8c3f4c972 random.h (random_device): Move implementation to...
* include/bits/random.h (random_device): Move implementation to...
	* src/c++11/random.cc: ...here.  New file.
	* config/abi/pre/gnu.ver: Add new version GLIBCXX_3.4.18.  Export
	std::random_device::* symbols.
	* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Generated.
	* src/c++11/Makefile.am (sources): Add random.cc.
	* src/c++11/Makefile.in: Regenerated.

From-SVN: r190787
2012-08-29 22:05:41 +00:00
Ulrich Drepper
7b93bdde91 Add interfaces to retrieve random numbers in bulk.
* include/bits/random.h (uniform_int_distribution<>): Add __generate
	and __generate_impl functions.
	(uniform_real_distribution<>): Likewise.
	(bernoulli_distribution): Likewise.
	(geometric_distribution<>): Likewise.
	(negative_binomial_distribution<>): Likewise.
	(poisson_distribution<>): Likewise.
	(exponential_distribution<>): Likewise.
	(normal_distribution<>): Likewise.
	(lognormal_distribution<>): Likewise.
	(chi_squared_distribution<>): Likewise.
	(cauchy_distribution<>): Likewise.
	(fisher_f_distribution<>): Likewise.
	(student_t_distribution<>): Likewise.
	(gamma_distribution<>): Likewise.
	(weibull_distribution<>): Likewise.
	(extreme_value_distribution<>): Likewise.
	(discrete_distribution<>): Likewise.
	(piecewise_constant_distribution<>): Likewise.
	(piecewise_linear_distribution<>): Likewise.
	* include/bits/random.tcc (__detail::_Power_of_2): New function.
	(uniform_int_distribution<>::__generate_impl): New function.
	(uniform_real_distribution<>::__generate_impl): New function.
	(bernoulli_distribution::__generate_impl): New function.
	(geometric_distribution<>::__generate_impl): New function.
	(negative_binomial_distribution<>::__generate_impl): New function.
	(poisson_distribution<>::__generate_impl): New function.
	(exponential_distribution<>::__generate_impl): New function.
	(normal_distribution<>::__generate_impl): New function.
	(lognormal_distribution<>::__generate_impl): New function.
	(chi_squared_distribution<>::__generate_impl): New function.
	(cauchy_distribution<>::__generate_impl): New function.
	(fisher_f_distribution<>::__generate_impl): New function.
	(student_t_distribution<>::__generate_impl): New function.
	(gamma_distribution<>::__generate_impl): New function.
	(weibull_distribution<>::__generate_impl): New function.
	(extreme_value_distribution<>::__generate_impl): New function.
	(discrete_distribution<>::__generate_impl): New function.
	(piecewise_constant_distribution<>::__generate_impl): New function.
	(piecewise_linear_distribution<>::__generate_impl): New function.

From-SVN: r190712
2012-08-27 14:13:15 +00:00
Ulrich Drepper
b668e41af6 random.h (mersenne_twister_engine): Don't inline discard here.
* include/bits/random.h (mersenne_twister_engine): Don't inline
	discard here.  New member function _M_gen_rand.
	* include/bits/random.tcc (mersenne_twister_engine<>::_M_gen_rand):
	New function.  Extracted from operator().
	(mersenne_twister_engine<>::discard): New implementation which
	skips in large steps.
	(mersenne_twister_engine<>::operator()): Use _M_gen_rand.

From-SVN: r190711
2012-08-27 12:08:16 +00:00
Marc Glisse
a30e18c147 re PR libstdc++/54376 (incorrect complaint about redefinition)
2012-08-26  Marc Glisse  <marc.glisse@inria.fr>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/54376
	* include/bits/random.h (lognormal_distribution<>::operator==,
	gamma_distribution<>::operator==,
	chi_squared_distribution<>::operator==,
	fisher_f_distribution<>::operator==,
	student_t_distribution<>::operator==,
	binomial_distribution<>::operator==,
	negative_binomial_distribution<>::operator==,
	poisson_distribution<>::operator==): Change inline friend definition
	to non-template.
	* testsuite/26_numerics/random/binomial_distribution/requirements/
	explicit_instantiation/1.cc: New.
	* testsuite/26_numerics/random/cauchy_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/discrete_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/exponential_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/gamma_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/geometric_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/normal_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/piecewise_constant_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/poisson_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/student_t_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/
	requirements/explicit_instantiation/1.cc: Likewise.
	* testsuite/26_numerics/random/weibull_distribution/requirements/
	explicit_instantiation/1.cc: Likewise.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>

From-SVN: r190694
2012-08-26 17:22:43 +00:00
Jonathan Wakely
6d79ba303c re PR libstdc++/54351 (~unique_ptr() should not set stored pointer to null)
PR libstdc++/54351
	* include/bits/unique_ptr.h (unique_ptr<T>::~unique_ptr): Do not use
	reset().
	(unique_ptr<T[]>::~unique_ptr()): Likewise.
	* testsuite/20_util/unique_ptr/54351.cc: New.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
	line numbers.

From-SVN: r190676
2012-08-26 01:12:40 +01:00
Jonathan Wakely
05ee55c46b re PR libstdc++/54248 (Comment in standard library header talks about boost)
PR libstdc++/54248
	* include/bits/concept_check.h: Replace references to boost
	namespace.

From-SVN: r190668
2012-08-25 19:51:53 +01:00
François Dumont
181a5a136f 2012-08-10 François Dumont <fdumont@gcc.gnu.org>
Ollie Wild  <aaw@google.com>

	* include/bits/hashtable.h
	(_Hashtable<>_M_insert_multi_node(hash_code, node_type*)): New.
	(_Hashtable<>_M_insert(_Args&&, false_type)): Use latter.
	(_Hashtable<>::_M_emplace(false_type, _Args&&...)): Likewise.
	(_Hashtable<>::_M_insert_bucket): Replace by ...
	(_Hashtable<>::_M_insert_unique_node(size_type, hash_code, node_type*)):
	... this, new.
	(_Hashtable<>::_M_insert(_Args&&, true_type)): Use latter.
	(_Hashtable<>::_M_emplace(true_type, _Args&&...)): Likewise.
	* include/bits/hashtable_policy.h (_Map_base<>::operator[]): Use
	latter, emplace the value_type rather than insert.
	* include/std/unordered_map: Include tuple.
	* include/std/unordered_set: Likewise.
	* testsuite/util/testsuite_counter_type.h: New.
	* testsuite/23_containers/unordered_map/operators/2.cc: New.

Co-Authored-By: Ollie Wild <aaw@google.com>

From-SVN: r190355
2012-08-13 19:43:19 +00:00
Jonathan Wakely
9ab48d6e6c acinclude.m4: Update references to final C++11 standard.
* acinclude.m4: Update references to final C++11 standard.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/std/chrono: Likewise.
	* include/std/thread: Likewise.

From-SVN: r190271
2012-08-09 23:45:20 +01:00
Benjamin Kosnik
743ca87fe8 re PR libstdc++/54005 (Use __atomic_always_lock_free in libstdc++ is_lock_free instead of __atomic_is_lock_free)
2012-08-07  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/54005
	* include/std/atomic: Use __atomic_always_lock_free.
	* include/bits/atomic_base.h: Same.

From-SVN: r190216
2012-08-07 23:03:55 +00:00
Paolo Carlini
75235f0597 revert: stl_map.h (operator[](key_type&&)): Replace std::make_pair with value_type.
2012-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

	Revert:
	2012-08-03  Ollie Wild  <aaw@google.com>
		    Richard Smith  <richardsmith@google.com>

	* include/bits/stl_map.h (operator[](key_type&&)): Replace
	std::make_pair with value_type.
	* testsuite/23_containers/map/operators/2.cc: New test.

From-SVN: r190142
2012-08-04 11:44:28 +00:00
Ollie Wild
2222df9f39 stl_map.h (operator[](key_type&&)): Replace std::make_pair with value_type.
2012-08-03  Ollie Wild  <aaw@google.com>
	    Richard Smith  <richardsmith@google.com>

	* include/bits/stl_map.h (operator[](key_type&&)): Replace
	std::make_pair with value_type.
	* testsuite/23_containers/map/operators/2.cc: New test.

Co-Authored-By: Richard Smith <richardsmith@google.com>

From-SVN: r190128
2012-08-03 15:26:36 +00:00
Jonathan Wakely
6e48db73ed memory: Include auto_ptr.h later.
* include/std/memory: Include auto_ptr.h later.
	* include/bits/shared_ptr.h (shared_ptr(auto_ptr<_Up>&&): Remove
	definition.
	* include/bits/shared_ptr_base.h (__shared_ptr(auto_ptr<_Up>&&):
	Likewise.
	* include/bits/unique_ptr.h (unique_ptr(auto_ptr<_Up>&&): Likewise.
	* include/backward/auto_ptr.h (unique_ptr(auto_ptr<_Up>&&): Define.
	(shared_ptr(auto_ptr<_Up>&&, __shared_ptr(auto_ptr<_Up>&&): Likewise.
	* include/std/future: Reduce header dependencies.
	* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line
	numbers.
	* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.

From-SVN: r190109
2012-08-03 01:27:48 +01:00
François Dumont
62d3d3d431 c++config (_GLIBCXX_END_NAMESPACE_CONTAINER): Fix order of closures.
2012-07-30  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/c++config (_GLIBCXX_END_NAMESPACE_CONTAINER): Fix
	order of closures.
	(_GLIBCXX_END_NAMESPACE_ALGO): Likewise.

From-SVN: r189986
2012-07-30 20:08:59 +00:00
François Dumont
78aa145d9e re PR libstdc++/54075 ([4.7.1] unordered_map insert still slower than 4.6.2)
2012-07-29  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/54075
	* include/bits/hashtable_policy.h
	(_Prime_rehash_policy::_M_next_bkt): Add a growth factor set to 2
	to boost growth in the number of buckets.
	* testsuite/performance/23_containers/insert/unordered_set.cc: New.

From-SVN: r189938
2012-07-29 16:44:18 +00:00
François Dumont
2514d7f1ff re PR libstdc++/54075 ([4.7.1] unordered_map insert still slower than 4.6.2)
2012-07-25  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/54075
	* include/bits/hashtable.h
	(_Hashtable<>::_Hashtable(_InputIterator, _InputIterator,
	size_type, ...): Remove std::max usage to guarantee that hashtable
	state is consistent with hash policy state.
	(_Hashtable<>::rehash): Likewise. Set _M_prev_resize to 0 to avoid
	the hashtable to be shrinking on next insertion.
	* testsuite/23_containers/unordered_set/modifiers/reserve.cc: New.
	* testsuite/23_containers/unordered_multiset/modifiers/reserve.cc: New.
	* testsuite/23_containers/unordered_map/modifiers/reserve.cc: New.
	* testsuite/23_containers/unordered_multimap/modifiers/reserve.cc: New.

From-SVN: r189863
2012-07-25 19:32:48 +00:00
Jonathan Wakely
8db81fb2fe re PR libstdc++/53978 (Missing static const definitions in <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
2012-07-16 21:43:11 +01:00
Paolo Carlini
57cee56a1e re PR libstdc++/53657 ([C++11] pair(pair&&) move constructor is non-trivial)
2012-07-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/53657
	* include/bits/stl_pair.h (pair<>::pair(pair&&)): Declare defaulted,
	per C++11.
	* include/bits/stl_map.h (map<>::insert(_Pair&&), map<>::insert
	(const_iterator, _Pair&&)): Constrain with std::is_constructible,
	per LWG2005.
	* include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
	multimap<>::insert(const_iterator, _Pair&&)): Likewise.
	* include/bits/hashtable_policy.h (_Insert<>::insert(_Pair&&),
	_Insert<>::insert(const_iterator, _Pair&&)): Likewise.
	* include/debug/unordered_map: Adjust.
	* include/debug/map.h: Likewise.
	* include/debug/multimap.h: Likewise.
	* include/profile/unordered_map: Likewise.
	* include/profile/map.h: Likewise.
	* include/profile/multimap.h: Likewise.

From-SVN: r189456
2012-07-13 08:59:58 +00:00
Paolo Carlini
d695f91575 revert: re PR libstdc++/49561 ([C++0x] std::list::size complexity)
2012-07-02  Paolo Carlini  <paolo.carlini@oracle.com>

	Revert:
	2011-10-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/49561
	* include/bits/stl_list.h (_List_base<>::_List_impl::_M_size):
	Add in C++0x mode.
	(_List_base<>::_List_impl, _List_base<>::_M_get_node,
	_List_base<>::_M_put_node, _List_base<>::_List_base(_List_base&&),
	list<>::size, list<>::swap, list<>::splice): Use it.
	(operator==(const list<>&, const list<>&)): Rewrite in C++0x mode.
	* include/bits/list.tcc (list<>::erase): Likewise.
	(list<>::merge): Adjust in C++0x mode.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.

From-SVN: r189185
2012-07-03 00:47:17 +00:00
Benjamin Kosnik
e07b233d2e c++config: Remove __regex nested namespace.
2012-06-27  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/c++config: Remove __regex nested namespace.
	* include/bits/regex_compiler.h: Change __regex to
	__detail. Adjust doxygen markup, add regex-details group.
	* include/bits/regex_constants.h: Same.
	* include/bits/regex_cursor.h: Same.
	* include/bits/regex_error.h: Same.
	* include/bits/regex_grep_matcher.h: Same.
	* include/bits/regex_grep_matcher.tcc: Same.
	* include/bits/regex_nfa.h: Same.
	* include/bits/regex_nfa.tcc: Same.
	* include/bits/regex.h: Same. Remove static from global constants.

	* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers.

	* include/bits/locale_classes.tcc: Add use_facet, has_facet to
	locales group.

From-SVN: r189039
2012-06-28 07:50:34 +00:00
Benjamin Kosnik
7033d59e69 re PR libstdc++/53543 ([unordered_map] conflict with __is_convertible clang intrinsic)
2012-05-31  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/53543
	* include/bits/hashtable_policy.h (_Insert::__is_convertible):
	Rename to __is_conv to avoid clash with clang built-in.

From-SVN: r188088
2012-05-31 23:02:18 +00:00
François Dumont
80a009e565 2012-05-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tempbuf.h (__uninitialized_construct_buf)
	(__uninitialized_construct_buf_dispatch<>::__ucr): Fix to work
	with iterator returning rvalue.
	* testsuite/25_algorithms/stable_sort/3.cc: New.

From-SVN: r187985
2012-05-29 19:29:29 +00:00
Dodji Seketeli
650dc14a73 PR c++/53322 - -Wunused-local-typedefs is not enabled by Wall or Wunused
As the audit trail of this shows, -Wunused-local-typedefs is not
turned on by -Wunused after all.  Sigh.

Now that we have the EnabledBy construct for the *.opt files, it's
more precise and concise to use that to make -Wunused-local-typedefs
be triggered by -Wunused.

I have changed the gcc+.dg/warn/Wunused-local-typedefs.C test case to
make it use -Wunused instead of -Wunused-local-typedefs.  I had to
adjust it to avoid the warnings due to the other -W* options triggered
by -Wunused there.

While testing the compiler, it turned out that some local typedefs
were not being used when the experimental "Concepts" support is turned
off, in the libstdc++ test suite.  I also had to remove some obvious
useless local typedef usage in the fortran front-end.  Fixed thus.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

gcc/c-family/

	PR c++/53322
	* c.opt (Wunused-local-typedefs): Use EnabledBy(Wunused).

libstdc++-v3/

	PR c++/53322
	* include/bits/stl_algobase.h (lower_bound)
	(lexicographical_compare): Do not declare unused local typedefs
	here when Concepts are turned off.

gcc/fortran/

	PR c++/53322
	* f95-lang.c (gfc_init_builtin_functions): Remove the unused
	typedef builtin_type.

gcc/testsuite/

	PR c++/53322
	* g++.dg/warn/Wunused-local-typedefs.C: Adjust to use -Wunused
	instead of -Wunused-local-typedefs.

From-SVN: r187757
2012-05-22 05:50:26 +02:00
Paolo Carlini
5ac4e73a1d re PR libstdc++/53339 (unordered_map::iterator requires Value to be complete type)
2012-05-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/53339
	* include/bits/hashtable_policy.h (__detail::_Identity,
	__detail::_Select1st): Add.
	(_Map_base, _Hashtable_base): Use the latter, adjust parameters.
	* include/bits/hashtable.h (_Hashtable::__key_extract): Adjust.
	* include/bits/unordered_set.h (__uset_hashtable, __umset_hashtable):
	Likewise.
	* include/bits/unordered_map.h (__umap_hashtable, __ummap_hashtable):
	Likewise.
	* include/bits/stl_function.h (_Identity, _Select1st, _Select2nd)
	Unconditionally derive from unary_function.
	* include/ext/functional (identity, select1st, select2nd): Remove
	#ifdef __GXX_EXPERIMENTAL_CXX0X__ bits.
	* testsuite/23_containers/unordered_map/requirements/53339.cc: New.
	* testsuite/23_containers/unordered_multimap/requirements/
	53339.cc: Likewise.

From-SVN: r187515
2012-05-15 10:00:19 +00:00
DJ Delorie
586518549e random.tcc (seed_seq::generate): Cast max() operands to size_t to ensure a template match.
* include/bits/random.tcc (seed_seq::generate): Cast max()
operands to size_t to ensure a template match.
* include/std/bitset (_M_copy_from_ptr): Cast min() operands to
size_t to ensure a template match.

From-SVN: r187376
2012-05-10 16:32:47 -04:00
Benjamin Kosnik
d632488ae0 re PR libstdc++/44015 (template parameters not documented)
2012-05-02  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/44015
	* include/bits/basic_ios.h: Add tparam markup for
	* doxygen.  include/bits/basic_string.h: Same.
	* include/bits/forward_list.h: Same.
	* include/bits/stl_bvector.h: Same.
	* include/bits/stl_deque.h: Same.
	* include/bits/stl_list.h: Same.  include/bits/stl_map.h:
	* Same.  include/bits/stl_multimap.h: Same.
	* include/bits/stl_multiset.h: Same.
	* include/bits/stl_pair.h: Same.
	* include/bits/stl_queue.h: Same.
	* include/bits/stl_set.h: Same.
	* include/bits/stl_stack.h: Same.
	* include/bits/stl_vector.h: Same.
	* include/bits/unordered_map.h: Same.
	* include/bits/unordered_set.h: Same.  include/std/array:
	* Same.  include/std/atomic: Same.  include/std/fstream:
	* Same.  include/std/istream: Same.  include/std/ostream:
	* Same.  include/std/sstream: Same.
	* include/std/streambuf: Same.
	* testsuite/23_containers/deque/requirements/dr438/*:
          Adjust line numbers.
	* testsuite/23_containers/list/requirements/dr438/*: Same.
	* testsuite/23_containers/vector/requirements/dr438/*: Same.

From-SVN: r187066
2012-05-02 22:25:28 +00:00
Benjamin Kosnik
63dc7fbee0 hashtable_policy.h: Correct namepace nesting for _Hashtable forward declaration.
2012-05-02  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/hashtable_policy.h: Correct namepace nesting for
	_Hashtable forward declaration.

From-SVN: r187052
2012-05-02 16:22:06 +00:00
François Dumont
b7a9facb2c re PR libstdc++/53115 (_Hashtable::_M_rehash_aux(false_type) is broken)
2012-05-01  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/53115
	* include/bits/hashtable.h
	(_Hashtable<>::_M_rehash_aux(size_type, false_type)): Fix buckets
	after insertion of several equivalent elements.
	* testsuite/23_containers/unordered_multiset/insert/53115.cc: New.
	* testsuite/23_containers/unordered_multimap/insert/53115.cc: New.

From-SVN: r187025
2012-05-01 20:29:16 +00:00
Marc Glisse
cf48c25519 re PR libstdc++/51795 (linear_congruential_engine doesn't work correctly)
2012-04-29  Marc Glisse  <marc.glisse@inria.fr>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/51795
	* include/bits/stl_algobase.h (__lg<>(_Size)): Remove.
	(__lg(int), __lg(unsigned), __lg(long), __lg(unsigned long),
	__lg(long long), __lg(unsigned long long)): Define constexpr.
	* include/bits/random.h (_Mod<>): Overcome Schrage's algorithm
	limitations.
	(__mod): Adjust.
	(linear_congruential): Remove FIXME static_assert.
	* include/bits/random.tcc (_Mod<>): Adjust.
	* testsuite/26_numerics/random/linear_congruential_engine/operators/
	51795.cc: New.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>

From-SVN: r186948
2012-04-29 23:36:09 +00:00
Benjamin Kosnik
af6204cc29 hashtable.h: Adjust doxygen markup for base classes.
2012-04-25  Benjamin Kosnik  <bkoz@redhat.com>

	*  include/bits/hashtable.h: Adjust doxygen markup for base classes.
	*  include/bits/hashtable_policy.h: Same.

From-SVN: r186856
2012-04-26 02:20:32 +00:00
Paolo Carlini
970aa0b9a9 re PR c++/53067 (c++0x GCC 4.7.0 Regression std::ref with unordered sets)
2012-04-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/53067
	* include/bits/hashtable_policy.h: Change inheritances to public.
	* testsuite/23_containers/unordered_map/requirements/53067.cc: New.
	* testsuite/23_containers/unordered_set/requirements/53067.cc: Likewise.

From-SVN: r186676
2012-04-22 17:37:57 +00:00
Jonathan Wakely
fcf6e948d1 ptr_traits.h (pointer_traits::rebind): Make public.
* include/bits/ptr_traits.h (pointer_traits::rebind): Make public.
	* testsuite/20_util/pointer_traits/requirements/typedefs.cc: Check
	rebind works.

From-SVN: r186670
2012-04-22 14:42:38 +01:00
Paolo Carlini
f84ca6e7ce re PR libstdc++/52699 (infinite loop generated with -O0)
2012-04-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/52699
	* include/bits/random.tcc (independent_bits_engine<>::operator()())
	Avoid various overflows; use common_type on result_type and
	_RandomNumberEngine::result_type; avoid floating point computations;
	other smaller tweaks.

	* include/bits/random.tcc (uniform_int_distribution<>::operator())
	Use common_type; assume _UniformRandomNumberGenerator::result_type
	unsigned; tidy.

	* include/bits/stl_algobase.h (__lg(unsigned), __lg(unsigned long),
	__lg(unsigned long long)): Add.

From-SVN: r186456
2012-04-14 22:33:22 +00:00
Benjamin Kosnik
4dad8b49ee unordered_map.h (__unordered_map): Remove.
2012-04-12  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/unordered_map.h (__unordered_map): Remove.
	(__unordered_multimap): Remove.
	Add aliases for __umap_traits, __umap_hashtable, __ummap_traits,
	__ummap_hashtable.
	(unordered_map): Derive from __umap_hashtable.
	(unordered_multimap): Derive from __ummap_hashtable.
	* include/bits/unordered_set.h (__unordered_set): Remove.
	(__unordered_multiset): Remove.
	Add aliases for __uset_traits, __uset_hashtable, __umset_traits,
	__umset_hashtable.
	(unordered_set): Derive from __uset_hashtable.
	(unordered_multiset): Derive from __umset_hashtable.
	* include/bits/hashtable.h (__cache_default): New, consolidated
	cache defaults for _Hashtable. Adjust comments for doxygen.
	(_Hashtable): Consolidate bool template parameters into new,
	_Traits class. Inherited base classes synthesize _Hashtable in
	CRTP via original 10 parameters. Prefer using declarations to
	typedefs, add __node_type, __bucket_type, etc. Push many nested
	types down hierarchy to _Hashtable_base. Add constructors
	necessary for top-level unordered_containers. Consolidate insert
	member functions and logic in new base class, __detail::_Insert
	and __detail::_Insert_base.
	(_Hashtable::operator=(initializer_list)): Add.
	* include/bits/hashtable_policy.h: Convert to doxygen markup.
	(_Hashtable_traits) New. Consolidate bool template parameters here.
	(_Insert, _Insert_base): New, consolidated insert member functions.
	(_Map_base, _Equality, _Rehash_base): Adjust template parameters,
	use base types.
	(_Hashtable_base): Move type declarations useful to other base
	classes into this class.
	* python/libstdcxx/v6/printers.py (Tr1HashtableIterator): Update.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc:
	Adjust traits, line numbers.

From-SVN: r186403
2012-04-13 00:33:10 +00:00
Jeffrey Yasskin
2fc9b37dd0 Fix PR52822 (stable_partition move-assigns object to itself) by scanning for...
Fix PR52822 (stable_partition move-assigns object to itself) by
scanning for the first value that doesn't match the predicate before
starting to rearrange values.

2012-04-03   Jeffrey Yasskin  <jyasskin@google.com>

	PR libstdc++/52822
	* include/bits/stl_algo.h (__find_if_not): Expose in
	C++98 mode.
	(__find_if_not_n): Like __find_if_not, but works on and updates a
	counted range instead of a bounded range.
	(stable_partition): Guarantee !__pred(*__first) in call to
	__stable_partition_adaptive() or __inplace_stable_partition().
	(__stable_partition_adaptive): Use new precondition to avoid
	moving/copying objects onto themselves.  Guarantee new
	precondition to recursive calls.
	(__inplace_stable_partition): Use new precondition to simplify
	base case, remove __last parameter.  Guarantee new precondition to
	recursive calls.
	* testsuite/25_algorithms/stable_partition/moveable.cc (test02):
	Test a sequence that starts with a value matching the predicate.
	* testsuite/25_algorithms/stable_partition/pr52822.cc:
	Test vectors, which have a destructive self-move-assignment.

From-SVN: r186391
2012-04-12 20:59:09 +00:00
Paolo Carlini
b9b0921497 re PR libstdc++/52942 (using std::ref with a std::unordered_map fails to compile)
2012-04-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/52942
	* include/bits/stl_function.h (_Identity, _Select1st, _Select2nd):
	In C++11 mode do not derive from std::unary_function.
	* include/ext/functional (identity, select1st, select2nd): Adjust.
	* testsuite/23_containers/unordered_map/requirements/52942.cc: New.
	* testsuite/23_containers/unordered_set/requirements/52942.cc: Likewise.

From-SVN: r186375
2012-04-12 12:18:06 +00:00
Jonathan Wakely
a00cc15e3d re PR c++/52924 (Using an std::function object as deleter of shared_ptr in C++0x mode does not compile)
PR libstdc++/52924
	* include/bits/shared_ptr_base.h (_Sp_counted_deleter): Add
	user-defined destructor.
	(_Sp_counted_inplace): Likewise.
	* testsuite/20_util/shared_ptr/cons/52924.cc: New.
	* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust dg-error
	line numbers.

From-SVN: r186363
2012-04-11 23:54:53 +01:00
Paolo Carlini
7826329699 forward_list.h (splice_after(const_iterator, forward_list&), [...]): Add per C++11 as published (and LWG 1310).
2012-04-11  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/forward_list.h (splice_after(const_iterator,
	forward_list&), splice_after(const_iterator, forward_list&,
	consst_iterator), splice_after(const_iterator, forward_list&,
	const_iterator, const_iterator), merge(forward_list&),
	merge(forward_list&, _Comp)): Add per C++11 as published (and
	LWG 1310).
	* include/debug/forward_list: Adjust.

	* include/bits/forward_list.h (splice_after(const_iterator,
	forward_list&&, const_iterator)): Only declare.
	(_M_transfer_after): Remove.
	(_M_splice_after(const_iterator, forward_list&&)): Change signature.
	(splice_after(const_iterator, forward_list&&, const_iterator,
	const_iterator)): Use the latter.
	* include/bits/forward_list.tcc (splice_after(const_iterator,
	forward_list&&, const_iterator)): Define here.
	(_M_splice_after): Define, use throughout.

	* include/bits/forward_list.h (insert_after(const_iterator,
	std::initializer_list<_Tp>)): Forward to insert_after(const_iterator,
	_InputIterator, _InputIterator).
	* include/bits/forward_list.tcc: Remove definition.

	* testsuite/23_containers/forward_list/modifiers/6.cc: New.
	* testsuite/23_containers/forward_list/operations/1.cc: Adjust.

From-SVN: r186338
2012-04-11 17:31:57 +00:00
Paolo Carlini
b16212bd3c re PR libstdc++/52931 (std::hash shouldn't be defined for unknown types)
2012-04-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/52931
	* include/bits/functional_hash.h (struct hash): Remove definition.
	* testsuite/20_util/hash/52931.cc: New.

From-SVN: r186310
2012-04-11 11:27:50 +00:00
Jonathan Wakely
ea2c1a6d67 re PR libstdc++/52591 ([C++0x] [4.7 Regression] moving std::vector relies on movable elements)
PR libstdc++/52591
	* include/bits/stl_vector.h (vector::operator=(vector&&)): Dispatch
	to _M_move_assign depending on whether allocator is moved.
	(vector::_M_move_assign): Add overloaded functions.
	* testsuite/23_containers/vector/52591.cc: New.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* 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: r186057
2012-04-01 23:04:54 +01:00
Jeffrey Yasskin
195940adc0 re PR libstdc++/52799 (deque::emplace(iterator, ...) tries to call push_front(...), which doesn't exist)
2012-03-30  Jeffrey Yasskin  <jyasskin@gcc.gnu.org>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/52799
	* include/bits/deque.tcc (emplace): Fix thinko, replace push_front
	-> emplace_front, and likewise for *_back.
	* testsuite/23_containers/deque/modifiers/emplace/52799.cc: New.
	* testsuite/23_containers/list/modifiers/emplace/52799.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/emplace/52799.cc: Likewise.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>

From-SVN: r186035
2012-03-31 01:56:55 +00:00
Paolo Carlini
21669dfe20 forward_list.h: Slightly tweak two comments.
2012-03-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/forward_list.h: Slightly tweak two comments.

From-SVN: r185737
2012-03-23 13:26:49 +00:00
Jonathan Wakely
b4db974a6b stl_list.h (list::_M_size): Use NSDMI.
* include/bits/stl_list.h (list::_M_size): Use NSDMI.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust line numbers.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r185580
2012-03-20 17:01:19 +00:00
Benjamin Kosnik
fa7548481a allocator.h (std::allocator): Base class is __allocator_base.
2012-03-19  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/allocator.h (std::allocator): Base class is
	__allocator_base.
	(uses_allocator): Add to sub-grouping.
	* include/ext/new_allocator.h: Doxygen markup for tparm.

	* config/allocator/bitmap_allocator_base.h: Use __allocator_base
	template alias in C++11.
	* config/allocator/malloc_allocator_base.h: Same.
	* config/allocator/mt_allocator_base.h: Same.
	* config/allocator/new_allocator_base.h: Same.
	* config/allocator/pool_allocator_base.h: Same.

From-SVN: r185544
2012-03-19 21:41:15 +00:00
François Dumont
ac0ab963f2 re PR libstdc++/52476 ([DR 518] Unordered multimap reorders equivalent elements)
2012-03-15  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/52476
	* include/bits/hashtable.h (_Hashtable<>::_M_rehash_aux): Add.
	(_Hashtable<>::_M_rehash): Use the latter.
	* testsuite/23_containers/unordered_multimap/insert/52476.cc: New.
	* testsuite/23_containers/unordered_multiset/insert/52476.cc: New.

From-SVN: r185476
2012-03-16 21:03:15 +00:00
Paolo Carlini
43094d442e forward_list.h: Fix comments.
2012-03-14  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/forward_list.h: Fix comments.

From-SVN: r185382
2012-03-14 13:19:43 +00:00
Benjamin Kosnik
d8dd52a990 user.cfg.in: Update to Doxygen 1.8.0.
2012-03-08  Benjamin Kosnik  <bkoz@redhat.com>

	    * doc/doxygen/user.cfg.in: Update to Doxygen 1.8.0.
	    * include/bits/locale_facets.h: Adjust markup to avoid warnings.
	    * include/ext/pb_ds/assoc_container.hpp: Same.
	    * include/ext/pb_ds/priority_queue.hpp: Same.
	    * include/std/fstream: Same.
	    * include/std/ratio: Same.
	    * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust line
	    numbers.
	    * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.

Co-Authored-By: Ramana Radhakrishnan <ramana@gcc.gnu.org>

From-SVN: r185094
2012-03-08 05:20:52 +00:00
Paolo Carlini
93d9a365d2 stl_algobase.h (iter_swap): In C++11 mode just call swap.
2012-03-05  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_algobase.h (iter_swap): In C++11 mode just
	call swap.
	* include/bits/stl_bvector.h (swap(_Bit_reference,
	_Bit_reference), swap(_Bit_reference, bool&),
	swap(bool&, _Bit_reference)): Add.
	* testsuite/23_containers/vector/bool/swap.cc: New.

From-SVN: r184939
2012-03-05 16:31:50 +00:00