diff options
| author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-21 19:38:35 +0000 |
|---|---|---|
| committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-21 19:38:35 +0000 |
| commit | ea7bcfa14191be2fa6e088e88b2878015153caab (patch) | |
| tree | 1c31336cdfeff923f53c1b30eceec959e8b95b5b /libstdc++-v3/doc/xml | |
| parent | 61364c598959d1bccf53fb8180f3e3b3797d40b1 (diff) | |
| download | ppe42-gcc-ea7bcfa14191be2fa6e088e88b2878015153caab.tar.gz ppe42-gcc-ea7bcfa14191be2fa6e088e88b2878015153caab.zip | |
PR libstdc++/56267
* include/bits/hashtable.h (__cache_default): Do not depend on
whether the hash function is DefaultConstructible or CopyAssignable.
(_Hashtable): Adjust static assertions.
* doc/xml/manual/containers.xml (containers.unordered.cache): Update.
* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
dg-error line number.
* testsuite/23_containers/unordered_set/
not_default_constructible_hash_neg.cc: Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206904 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/doc/xml')
| -rw-r--r-- | libstdc++-v3/doc/xml/manual/containers.xml | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/libstdc++-v3/doc/xml/manual/containers.xml b/libstdc++-v3/doc/xml/manual/containers.xml index 9791953b78d..653033da4d5 100644 --- a/libstdc++-v3/doc/xml/manual/containers.xml +++ b/libstdc++-v3/doc/xml/manual/containers.xml @@ -420,7 +420,7 @@ the hash code every time it's needed can improve performance, but the additional memory overhead can also reduce performance, so whether an unordered associative container caches the hash code or not depends on - a number of factors. The caching policy for GCC 4.8 is described below. + the properties described below. </para> <para> The C++ standard requires that <code>erase</code> and <code>swap</code> @@ -432,23 +432,8 @@ or <code>throw()</code>. </para> <para> - Secondly, libstdc++ also needs the hash code in the implementation of - <code>local_iterator</code> and <code>const_local_iterator</code> in - order to know when the iterator has reached the end of the bucket. - This means that the local iterator types will embed a copy of the hash - function when possible. - Because the local iterator types must be DefaultConstructible and - CopyAssignable, if the hash function type does not model those concepts - then it cannot be embedded and so the hash code must be cached. - Note that a hash function might not be safe to use when - default-constructed (e.g if it a function pointer) so a hash - function that is contained in a local iterator won't be used until - the iterator is valid, so the hash function has been copied from a - correctly-initialized object. - </para> - <para> - If the hash function is non-throwing, DefaultConstructible and - CopyAssignable then libstdc++ doesn't need to cache the hash code for + If the hash function is non-throwing then libstdc++ doesn't need to + cache the hash code for correctness, but might still do so for performance if computing a hash code is an expensive operation, as it may be for arbitrarily long strings. |

