aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/tr1
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-03-19 10:36:57 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-03-19 10:36:57 +0000
commit247d8075711bc24632eb919c15524ed095485c16 (patch)
tree884bdcb882db407e570871577799d5642ec6cc56 /libstdc++-v3/include/tr1
parent0aeb3cc6c9df098de6fe0d0433f98e260696399e (diff)
downloadgcc-247d8075711bc24632eb919c15524ed095485c16.zip
gcc-247d8075711bc24632eb919c15524ed095485c16.tar.gz
gcc-247d8075711bc24632eb919c15524ed095485c16.tar.bz2
stl_algo.h (shuffle): Add, per D3056.
2010-03-19 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_algo.h (shuffle): Add, per D3056. (random_shuffle): Fix signature in C++0x mode. (lower_bound, __lg): Move... * include/bits/stl_algobase.h: ... here. * include/bits/algorithmfwd.h: Adjust. * include/parallel/algorithmfwd.h: Likewise. * include/parallel/algo.h: Likewise. * include/bits/hashtable_policy.h (__lower_bound): Remove, adjust callers. * include/tr1/hashtable_policy.h (__lower_bound): Likewise. * include/bits/random.tcc (__detail::__transform): Add, adjust std::transform callers; don't include <algorithm>. * testsuite/25_algorithms/shuffle/1.cc: Add. * testsuite/25_algorithms/shuffle/requirements/ explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/shuffle/requirements/ explicit_instantiation/pod.cc: Likewise. * include/bits/random.h: Add comments. From-SVN: r157564
Diffstat (limited to 'libstdc++-v3/include/tr1')
-rw-r--r--libstdc++-v3/include/tr1/hashtable_policy.h35
1 files changed, 6 insertions, 29 deletions
diff --git a/libstdc++-v3/include/tr1/hashtable_policy.h b/libstdc++-v3/include/tr1/hashtable_policy.h
index 60a4e64..2a0e0ed 100644
--- a/libstdc++-v3/include/tr1/hashtable_policy.h
+++ b/libstdc++-v3/include/tr1/hashtable_policy.h
@@ -55,29 +55,6 @@ namespace __detail
return __distance_fw(__first, __last, _Tag());
}
- template<typename _RAIter, typename _Tp>
- _RAIter
- __lower_bound(_RAIter __first, _RAIter __last, const _Tp& __val)
- {
- typedef typename std::iterator_traits<_RAIter>::difference_type _DType;
-
- _DType __len = __last - __first;
- while (__len > 0)
- {
- _DType __half = __len >> 1;
- _RAIter __middle = __first + __half;
- if (*__middle < __val)
- {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else
- __len = __half;
- }
- return __first;
- }
-
// Auxiliary types used for all instantiations of _Hashtable: nodes
// and iterators.
@@ -440,8 +417,8 @@ namespace __detail
_Prime_rehash_policy::
_M_next_bkt(std::size_t __n) const
{
- const unsigned long* __p = __lower_bound(__prime_list, __prime_list
- + _S_n_primes, __n);
+ const unsigned long* __p = std::lower_bound(__prime_list, __prime_list
+ + _S_n_primes, __n);
_M_next_resize =
static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
return *__p;
@@ -454,8 +431,8 @@ namespace __detail
_M_bkt_for_elements(std::size_t __n) const
{
const float __min_bkts = __n / _M_max_load_factor;
- const unsigned long* __p = __lower_bound(__prime_list, __prime_list
- + _S_n_primes, __min_bkts);
+ const unsigned long* __p = std::lower_bound(__prime_list, __prime_list
+ + _S_n_primes, __min_bkts);
_M_next_resize =
static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
return *__p;
@@ -483,8 +460,8 @@ namespace __detail
{
__min_bkts = std::max(__min_bkts, _M_growth_factor * __n_bkt);
const unsigned long* __p =
- __lower_bound(__prime_list, __prime_list + _S_n_primes,
- __min_bkts);
+ std::lower_bound(__prime_list, __prime_list + _S_n_primes,
+ __min_bkts);
_M_next_resize = static_cast<std::size_t>
(__builtin_ceil(*__p * _M_max_load_factor));
return std::make_pair(true, *__p);