diff --git a/doc/rationale.qbk b/doc/rationale.qbk
index 819efb87..e52cefbc 100644
--- a/doc/rationale.qbk
+++ b/doc/rationale.qbk
@@ -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`]
diff --git a/doc/ref.xml b/doc/ref.xml
index 1315a073..26f5ef77 100644
--- a/doc/ref.xml
+++ b/doc/ref.xml
@@ -526,6 +526,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
A local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the first element in the bucket with index n
.
+
+
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
@@ -1105,6 +1129,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
A local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the first element in the bucket with index n
.
+
+
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
@@ -1735,6 +1783,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
A local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the first element in the bucket with index n
.
+
+
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
@@ -2324,6 +2396,30 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
A local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the first element in the bucket with index n
.
+
+
+
+
+ size_type
+
+ const_local_iterator
+
+ n
shall be in the range [0, bucket_count())
.
+
+
+ A constant local iterator pointing the 'one past the end' element in the bucket with index n
.
+
+
diff --git a/include/boost/unordered_map.hpp b/include/boost/unordered_map.hpp
index 1fd2749c..48609ce0 100644
--- a/include/boost/unordered_map.hpp
+++ b/include/boost/unordered_map.hpp
@@ -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
diff --git a/include/boost/unordered_set.hpp b/include/boost/unordered_set.hpp
index 15c20c15..011440a4 100644
--- a/include/boost/unordered_set.hpp
+++ b/include/boost/unordered_set.hpp
@@ -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
diff --git a/test/unordered/bucket_tests.cpp b/test/unordered/bucket_tests.cpp
index ff819f4f..620e16f0 100644
--- a/test/unordered/bucket_tests.cpp
+++ b/test/unordered/bucket_tests.cpp
@@ -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)));
}
}
diff --git a/test/unordered/compile_tests.cpp b/test/unordered/compile_tests.cpp
index 6d3ae4ad..616b7423 100644
--- a/test/unordered/compile_tests.cpp
+++ b/test/unordered/compile_tests.cpp
@@ -190,6 +190,11 @@ void unordered_test(X&, Key& k, T& t, Hash& hf, Pred& eq)
test::check_return_type::equals(a.end(0));
test::check_return_type::equals(b.end(0));
+ test::check_return_type::equals(a.cbegin(0));
+ test::check_return_type::equals(b.cbegin(0));
+ test::check_return_type::equals(a.cend(0));
+ test::check_return_type::equals(b.cend(0));
+
test::check_return_type::equals(b.load_factor());
test::check_return_type::equals(b.max_load_factor());
a.max_load_factor((float) 2.0);