mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Merge: Support for cbegin(n), cend(n).
[SVN r42188]
This commit is contained in:
@ -137,6 +137,12 @@ of elements with equivalent keys (i.e. if they're stable under `insert` and `era
|
||||
This is [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#518 issue 581].
|
||||
The current proposal is that insert, erase and rehash are stable - so they are here.
|
||||
|
||||
[h3 const_local_iterator cbegin, cend missing from TR1]
|
||||
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2482.html#691
|
||||
Issue 691] is that `cbegin` and `cend` are missing for local iterators.
|
||||
The current resolution is that they'll be added, so I've added them.
|
||||
|
||||
[h2 Future Developments]
|
||||
|
||||
[h3 Support for `emplace`]
|
||||
|
96
doc/ref.xml
96
doc/ref.xml
@ -526,6 +526,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</overloaded-method>
|
||||
<method name="cbegin" cv="const">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
<method name="cend">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
</method-group>
|
||||
<method-group name="hash policy">
|
||||
<method name="load_factor" cv="const">
|
||||
@ -1105,6 +1129,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</overloaded-method>
|
||||
<method name="cbegin" cv="const">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
<method name="cend">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
</method-group>
|
||||
<method-group name="hash policy">
|
||||
<method name="load_factor" cv="const">
|
||||
@ -1735,6 +1783,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</overloaded-method>
|
||||
<method name="cbegin" cv="const">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
<method name="cend">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
</method-group>
|
||||
<method-group name="hash policy">
|
||||
<method name="load_factor" cv="const">
|
||||
@ -2324,6 +2396,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</overloaded-method>
|
||||
<method name="cbegin" cv="const">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
<method name="cend">
|
||||
<parameter name="n">
|
||||
<paramtype>size_type</paramtype>
|
||||
</parameter>
|
||||
<type>const_local_iterator</type>
|
||||
<requires>
|
||||
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
|
||||
</requires>
|
||||
<returns>
|
||||
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
|
||||
</returns>
|
||||
</method>
|
||||
</method-group>
|
||||
<method-group name="hash policy">
|
||||
<method name="load_factor" cv="const">
|
||||
|
@ -294,7 +294,6 @@ namespace boost
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
return const_local_iterator(base.begin(n));
|
||||
@ -304,7 +303,6 @@ namespace boost
|
||||
{
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
// hash policy
|
||||
|
||||
@ -593,7 +591,6 @@ namespace boost
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
return const_local_iterator(base.begin(n));
|
||||
@ -603,7 +600,6 @@ namespace boost
|
||||
{
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
// hash policy
|
||||
|
||||
|
@ -264,7 +264,6 @@ namespace boost
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
return const_local_iterator(base.begin(n));
|
||||
@ -274,7 +273,6 @@ namespace boost
|
||||
{
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
// hash policy
|
||||
|
||||
@ -548,7 +546,6 @@ namespace boost
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
return const_local_iterator(base.begin(n));
|
||||
@ -558,7 +555,6 @@ namespace boost
|
||||
{
|
||||
return const_local_iterator(base.end(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
// hash policy
|
||||
|
||||
|
@ -41,8 +41,10 @@ void bucket_tests(X* = 0)
|
||||
|
||||
for(size_type i = 0; i < x.bucket_count(); ++i) {
|
||||
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x.begin(i), x.end(i)));
|
||||
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x.cbegin(i), x.cend(i)));
|
||||
X const& x_ref = x;
|
||||
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x_ref.begin(i), x_ref.end(i)));
|
||||
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x_ref.cbegin(i), x_ref.cend(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,6 +190,11 @@ void unordered_test(X&, Key& k, T& t, Hash& hf, Pred& eq)
|
||||
test::check_return_type<local_iterator>::equals(a.end(0));
|
||||
test::check_return_type<const_local_iterator>::equals(b.end(0));
|
||||
|
||||
test::check_return_type<const_local_iterator>::equals(a.cbegin(0));
|
||||
test::check_return_type<const_local_iterator>::equals(b.cbegin(0));
|
||||
test::check_return_type<const_local_iterator>::equals(a.cend(0));
|
||||
test::check_return_type<const_local_iterator>::equals(b.cend(0));
|
||||
|
||||
test::check_return_type<float>::equals(b.load_factor());
|
||||
test::check_return_type<float>::equals(b.max_load_factor());
|
||||
a.max_load_factor((float) 2.0);
|
||||
|
Reference in New Issue
Block a user