Moved most components of the library to iterators:: namespace.

This change excludes boost:: and boost::detail:: namespaces from ADL for unqualified function calls (e.g. algorithms). This reduces the possibility of name clashes with other libraries and user's code. One of the effects should be fixing test failures on gcc 4.2 and 4.4 due to clashed with Boost.TypeTraits.

Also some of the functions marked with inline keyword.
This commit is contained in:
Andrey Semashev
2014-07-03 00:22:45 +04:00
parent e000b676cc
commit dc96d371fa
28 changed files with 596 additions and 442 deletions

View File

@ -29,11 +29,11 @@
namespace boost {
// use this for the value type
struct dummyT {
struct dummyT {
dummyT() { }
dummyT(detail::dummy_constructor) { }
dummyT(int x) : m_x(x) { }
int foo() const { return m_x; }
int foo() const { return m_x; }
bool operator==(const dummyT& d) const { return m_x == d.m_x; }
int m_x;
};
@ -41,9 +41,10 @@ struct dummyT {
}
namespace boost {
namespace iterators {
// Tests whether type Iterator satisfies the requirements for a
// TrivialIterator.
// TrivialIterator.
// Preconditions: i != j, *i == val
template <class Iterator, class T>
void trivial_iterator_test(const Iterator i, const Iterator j, T val)
@ -84,7 +85,7 @@ void mutable_trivial_iterator_test(const Iterator i, const Iterator j, T val)
// Preconditions: *i == v1, *++i == v2
template <class Iterator, class T>
void input_iterator_test(Iterator i, T v1, T v2)
void input_iterator_test(Iterator i, T v1, T v2)
{
Iterator i1(i);
@ -150,7 +151,7 @@ template <> struct lvalue_test<true> {
#endif
template <class Iterator, class T>
void forward_iterator_test(Iterator i, T v1, T v2)
void forward_iterator_test(Iterator i, T v1, T v2)
{
input_iterator_test(i, v1, v2);
@ -215,7 +216,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
int c;
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
for (c = 0; c < N-1; ++c) {
assert(i == j + c);
assert(*i == vals[c]);
@ -234,7 +235,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
assert(i == k - c);
assert(*i == vals[N - 1 - c]);
assert(*i == boost::implicit_cast<value_type>(j[N - 1 - c]));
Iterator q = k - c;
Iterator q = k - c;
assert(*i == *q);
assert(i > j);
assert(i >= j);
@ -260,6 +261,18 @@ void const_nonconst_iterator_test(Iterator i, ConstIterator j)
assert(i == k);
}
} // namespace iterators
using iterators::undefined;
using iterators::trivial_iterator_test;
using iterators::mutable_trivial_iterator_test;
using iterators::input_iterator_test;
using iterators::lvalue_test;
using iterators::forward_iterator_test;
using iterators::bidirectional_iterator_test;
using iterators::random_access_iterator_test;
using iterators::const_nonconst_iterator_test;
} // namespace boost
#endif // BOOST_ITERATOR_TESTS_HPP