18 changes: 12 additions & 6 deletions include/boost/iterator/filter_iterator.hpp
Expand Up @@ -14,8 +14,9 @@
#include <boost/type_traits/is_class.hpp>
#include <boost/static_assert.hpp>

namespace boost
{
namespace boost {
namespace iterators {

template <class Predicate, class Iterator>
class filter_iterator;

Expand All @@ -39,7 +40,7 @@ namespace boost
> type;
};
}

template <class Predicate, class Iterator>
class filter_iterator
: public detail::filter_iterator_base<Predicate, Iterator>::type
Expand Down Expand Up @@ -68,7 +69,7 @@ namespace boost
// Don't allow use of this constructor if Predicate is a
// function pointer type, since it will be 0.
BOOST_STATIC_ASSERT(is_class<Predicate>::value);
#endif
#endif
satisfy_predicate();
}

Expand Down Expand Up @@ -108,14 +109,14 @@ namespace boost
};

template <class Predicate, class Iterator>
filter_iterator<Predicate,Iterator>
inline filter_iterator<Predicate,Iterator>
make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator())
{
return filter_iterator<Predicate,Iterator>(f,x,end);
}

template <class Predicate, class Iterator>
filter_iterator<Predicate,Iterator>
inline filter_iterator<Predicate,Iterator>
make_filter_iterator(
typename iterators::enable_if<
is_class<Predicate>
Expand All @@ -126,6 +127,11 @@ namespace boost
return filter_iterator<Predicate,Iterator>(x,end);
}

} // namespace iterators

using iterators::filter_iterator;
using iterators::make_filter_iterator;

} // namespace boost

#endif // BOOST_FILTER_ITERATOR_23022003THW_HPP
17 changes: 13 additions & 4 deletions include/boost/iterator/function_input_iterator.hpp
Expand Up @@ -20,6 +20,8 @@

namespace boost {

namespace iterators {

namespace impl {

template <class Function, class Input>
Expand All @@ -33,7 +35,7 @@ namespace boost {
{
public:
function_input_iterator() {}
function_input_iterator(Function & f_, Input state_ = Input())
function_input_iterator(Function & f_, Input state_ = Input())
: f(&f_), state(state_) {}

void increment() {
Expand All @@ -44,7 +46,7 @@ namespace boost {
++state;
}

typename Function::result_type const &
typename Function::result_type const &
dereference() const {
return (value ? value : value = (*f)()).get();
}
Expand Down Expand Up @@ -109,7 +111,7 @@ namespace boost {
} // namespace impl

template <class Function, class Input>
class function_input_iterator
class function_input_iterator
: public mpl::if_<
function_types::is_function_pointer<Function>,
impl::function_pointer_input_iterator<Function,Input>,
Expand Down Expand Up @@ -154,7 +156,14 @@ namespace boost {
bool operator==(infinite &) const { return false; };
bool operator==(infinite const &) const { return false; };
};
}

} // namespace iterators

using iterators::function_input_iterator;
using iterators::make_function_input_iterator;
using iterators::infinite;

} // namespace boost

#endif

22 changes: 14 additions & 8 deletions include/boost/iterator/indirect_iterator.hpp
Expand Up @@ -30,12 +30,13 @@
# include <boost/scoped_ptr.hpp>
# include <boost/mpl/bool.hpp>
# include <memory>
#endif
#endif

#include <boost/iterator/detail/config_def.hpp> // must be last #include

namespace boost
{
namespace boost {
namespace iterators {

template <class Iter, class Value, class Category, class Reference, class Difference>
class indirect_iterator;

Expand All @@ -44,8 +45,8 @@ namespace boost
template <class Iter, class Value, class Category, class Reference, class Difference>
struct indirect_base
{
typedef typename iterator_traits<Iter>::value_type dereferenceable;
typedef typename boost::detail::iterator_traits<Iter>::value_type dereferenceable;

typedef iterator_adaptor<
indirect_iterator<Iter, Value, Category, Reference, Difference>
, Iter
Expand All @@ -69,7 +70,7 @@ namespace boost
struct indirect_base<int, int, int, int, int> {};
} // namespace detail


template <
class Iterator
, class Value = use_default
Expand Down Expand Up @@ -107,14 +108,14 @@ namespace boost
: super_t(y.base())
{}

private:
private:
typename super_t::reference dereference() const
{
# if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 )
return const_cast<super_t::reference>(**this->base());
# else
return **this->base();
# endif
# endif
}
};

Expand All @@ -132,6 +133,11 @@ namespace boost
return indirect_iterator<Iter, Traits>(x);
}

} // namespace iterators

using iterators::indirect_iterator;
using iterators::make_indirect_iterator;

} // namespace boost

#include <boost/iterator/detail/config_undef.hpp>
Expand Down
12 changes: 8 additions & 4 deletions include/boost/iterator/interoperable.hpp
Expand Up @@ -14,8 +14,8 @@

# include <boost/iterator/detail/config_def.hpp> // must appear last

namespace boost
{
namespace boost {
namespace iterators {

//
// Meta function that determines whether two
Expand All @@ -27,7 +27,7 @@ namespace boost
// standards requirements on constant/mutable container
// iterators (23.1 [lib.container.requirements]).
//
// For compilers that don't support is_convertible
// For compilers that don't support is_convertible
// is_interoperable gives false positives. See comments
// on operator implementation for consequences.
//
Expand All @@ -40,9 +40,13 @@ namespace boost
is_convertible< A, B >
, is_convertible< B, A > >
# endif
{
{
};

} // namespace iterators

using iterators::is_interoperable;

} // namespace boost

# include <boost/iterator/detail/config_undef.hpp>
Expand Down
37 changes: 22 additions & 15 deletions include/boost/iterator/is_lvalue_iterator.hpp
Expand Up @@ -18,28 +18,30 @@
#ifndef BOOST_NO_IS_CONVERTIBLE

namespace boost {


namespace iterators {

namespace detail
{
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
// Calling lvalue_preserver( <expression>, 0 ) returns a reference
// to the expression's result if <expression> is an lvalue, or
// not_an_lvalue() otherwise.
struct not_an_lvalue {};

template <class T>
T& lvalue_preserver(T&, int);

template <class U>
not_an_lvalue lvalue_preserver(U const&, ...);

# define BOOST_LVALUE_PRESERVER(expr) detail::lvalue_preserver(expr,0)

#else

# define BOOST_LVALUE_PRESERVER(expr) expr
#endif

#endif

// Guts of is_lvalue_iterator. Value is the iterator's value_type
// and the result is computed in the nested rebind template.
Expand All @@ -55,12 +57,12 @@ namespace detail

static char tester(conversion_eater, int);
static char (& tester(any_conversion_eater, ...) )[2];

template <class It>
struct rebind
{
static It& x;

BOOST_STATIC_CONSTANT(
bool
, value = (
Expand All @@ -75,7 +77,7 @@ namespace detail
};

#undef BOOST_LVALUE_PRESERVER

//
// void specializations to handle std input and output iterators
//
Expand Down Expand Up @@ -135,11 +137,16 @@ namespace detail
// Define the trait with full mpl lambda capability and various broken
// compiler workarounds
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_lvalue_iterator,T,::boost::detail::is_readable_lvalue_iterator_impl<T>::value)
is_lvalue_iterator,T,::boost::iterators::detail::is_readable_lvalue_iterator_impl<T>::value)

BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_non_const_lvalue_iterator,T,::boost::detail::is_non_const_lvalue_iterator_impl<T>::value)

is_non_const_lvalue_iterator,T,::boost::iterators::detail::is_non_const_lvalue_iterator_impl<T>::value)

} // namespace iterators

using iterators::is_lvalue_iterator;
using iterators::is_non_const_lvalue_iterator;

} // namespace boost

#endif
Expand Down
18 changes: 12 additions & 6 deletions include/boost/iterator/is_readable_iterator.hpp
Expand Up @@ -16,7 +16,9 @@
#ifndef BOOST_NO_IS_CONVERTIBLE

namespace boost {


namespace iterators {

namespace detail
{
// Guts of is_readable_iterator. Value is the iterator's value_type
Expand All @@ -26,12 +28,12 @@ namespace detail
{
static char tester(Value&, int);
static char (& tester(any_conversion_eater, ...) )[2];

template <class It>
struct rebind
{
static It& x;

BOOST_STATIC_CONSTANT(
bool
, value = (
Expand All @@ -44,7 +46,7 @@ namespace detail
};

#undef BOOST_READABLE_PRESERVER

//
// void specializations to handle std input and output iterators
//
Expand Down Expand Up @@ -97,8 +99,12 @@ namespace detail
// Define the trait with full mpl lambda capability and various broken
// compiler workarounds
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_readable_iterator,T,::boost::detail::is_readable_iterator_impl2<T>::value)

is_readable_iterator,T,::boost::iterators::detail::is_readable_iterator_impl2<T>::value)

} // namespace iterators

using iterators::is_readable_iterator;

} // namespace boost

#endif
Expand Down
104 changes: 57 additions & 47 deletions include/boost/iterator/iterator_adaptor.hpp
Expand Up @@ -31,28 +31,33 @@

#include <boost/iterator/iterator_traits.hpp>

namespace boost
{
namespace boost {
namespace iterators {

// Used as a default template argument internally, merely to
// indicate "use the default", this can also be passed by users
// explicitly in order to specify that the default should be used.
struct use_default;

# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// the incompleteness of use_default causes massive problems for
// is_convertible (naturally). This workaround is fortunately not
// needed for vc6/vc7.
template<class To>
struct is_convertible<use_default,To>
: mpl::false_ {};
# endif


} // namespace iterators

using iterators::use_default;

// the incompleteness of use_default causes massive problems for
// is_convertible (naturally). This workaround is fortunately not
// needed for vc6/vc7.
template<class To>
struct is_convertible<use_default,To>
: mpl::false_ {};

namespace iterators {

namespace detail
{

//
//
// Result type used in enable_if_convertible meta function.
// This can be an incomplete type, as only pointers to
// This can be an incomplete type, as only pointers to
// enable_if_convertible< ... >::type are used.
// We could have used void for this, but conversion to
// void* is just to easy.
Expand All @@ -73,7 +78,7 @@ namespace boost
// public iterator_adaptor< adapted_iterator<Iterator>, Iterator >
// {
// public:
//
//
// ...
//
// template <class OtherIterator>
Expand All @@ -92,23 +97,23 @@ namespace boost
// and not at the actual instantiation.
//
// enable_if_interoperable can be safely used in user code. It falls back to
// always enabled for compilers that don't support enable_if or is_convertible.
// There is no need for compiler specific workarounds in user code.
// always enabled for compilers that don't support enable_if or is_convertible.
// There is no need for compiler specific workarounds in user code.
//
// The operators implementation relies on boost::is_convertible not returning
// false positives for user/library defined iterator types. See comments
// on operator implementation for consequences.
//
# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE)

template <class From, class To>
struct enable_if_convertible
{
typedef boost::detail::enable_type type;
typedef boost::iterators::detail::enable_type type;
};

# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292))

// For some reason vc7.1 needs us to "cut off" instantiation
// of is_convertible in a few cases.
template<typename From, typename To>
Expand All @@ -118,22 +123,22 @@ namespace boost
is_same<From,To>
, is_convertible<From, To>
>
, boost::detail::enable_type
, boost::iterators::detail::enable_type
>
{};
# else

# else

template<typename From, typename To>
struct enable_if_convertible
: iterators::enable_if<
is_convertible<From, To>
, boost::detail::enable_type
, boost::iterators::detail::enable_type
>
{};

# endif

//
// Default template argument handling for iterator_adaptor
//
Expand Down Expand Up @@ -165,9 +170,9 @@ namespace boost
{
typedef iterator_facade<
Derived

# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
, typename boost::detail::ia_dflt_help<
, typename boost::iterators::detail::ia_dflt_help<
Value
, mpl::eval_if<
is_same<Reference,use_default>
Expand All @@ -176,17 +181,17 @@ namespace boost
>
>::type
# else
, typename boost::detail::ia_dflt_help<
, typename boost::iterators::detail::ia_dflt_help<
Value, iterator_value<Base>
>::type
# endif
, typename boost::detail::ia_dflt_help<

, typename boost::iterators::detail::ia_dflt_help<
Traversal
, iterator_traversal<Base>
>::type

, typename boost::detail::ia_dflt_help<
, typename boost::iterators::detail::ia_dflt_help<
Reference
, mpl::eval_if<
is_same<Value,use_default>
Expand All @@ -195,21 +200,21 @@ namespace boost
>
>::type

, typename boost::detail::ia_dflt_help<
, typename boost::iterators::detail::ia_dflt_help<
Difference, iterator_difference<Base>
>::type
>
type;
};

// workaround for aC++ CR JAGaf33512
template <class Tr1, class Tr2>
inline void iterator_adaptor_assert_traversal ()
{
BOOST_STATIC_ASSERT((is_convertible<Tr1, Tr2>::value));
}
}

//
// Iterator Adaptor
//
Expand Down Expand Up @@ -244,14 +249,14 @@ namespace boost
, class Difference = use_default
>
class iterator_adaptor
: public boost::detail::iterator_adaptor_base<
: public boost::iterators::detail::iterator_adaptor_base<
Derived, Base, Value, Traversal, Reference, Difference
>::type
{
friend class iterator_core_access;

protected:
typedef typename boost::detail::iterator_adaptor_base<
typedef typename boost::iterators::detail::iterator_adaptor_base<
Derived, Base, Value, Traversal, Reference, Difference
>::type super_t;
public:
Expand All @@ -270,7 +275,7 @@ namespace boost
protected:
// for convenience in derived classes
typedef iterator_adaptor<Derived,Base,Value,Traversal,Reference,Difference> iterator_adaptor_;

//
// lvalue access to the Base object for Derived
//
Expand All @@ -286,13 +291,13 @@ namespace boost
// to prevent temptation for Derived classes to use it, which
// will often result in an error. Derived classes should use
// base_reference(), above, to get direct access to m_iterator.
//
//
typename super_t::reference dereference() const
{ return *m_iterator; }

template <
class OtherDerived, class OtherIterator, class V, class C, class R, class D
>
>
bool equal(iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> const& x) const
{
// Maybe readd with same_distance
Expand All @@ -307,25 +312,25 @@ namespace boost
>::type my_traversal;

# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \
boost::detail::iterator_adaptor_assert_traversal<my_traversal, cat>();
boost::iterators::detail::iterator_adaptor_assert_traversal<my_traversal, cat>();

void advance(typename super_t::difference_type n)
{
BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag)
m_iterator += n;
}

void increment() { ++m_iterator; }

void decrement()
void decrement()
{
BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag)
--m_iterator;
}

template <
class OtherDerived, class OtherIterator, class V, class C, class R, class D
>
>
typename super_t::difference_type distance_to(
iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> const& y) const
{
Expand All @@ -338,11 +343,16 @@ namespace boost
}

# undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL

private: // data members
Base m_iterator;
};

} // namespace iterators

using iterators::iterator_adaptor;
using iterators::enable_if_convertible;

} // namespace boost

#include <boost/iterator/detail/config_undef.hpp>
Expand Down
83 changes: 47 additions & 36 deletions include/boost/iterator/iterator_archetypes.hpp
Expand Up @@ -31,14 +31,15 @@
#include <cstddef>

namespace boost {
namespace iterators {

template <class Value, class AccessCategory>
struct access_archetype;

template <class Derived, class Value, class AccessCategory, class TraversalCategory>
struct traversal_archetype;

namespace iterator_archetypes
namespace archetypes
{
enum {
readable_iterator_bit = 1
Expand All @@ -50,19 +51,19 @@ namespace iterator_archetypes
// Not quite tags, since dispatching wouldn't work.
typedef mpl::int_<readable_iterator_bit>::type readable_iterator_t;
typedef mpl::int_<writable_iterator_bit>::type writable_iterator_t;

typedef mpl::int_<
(readable_iterator_bit|writable_iterator_bit)
>::type readable_writable_iterator_t;

typedef mpl::int_<
(readable_iterator_bit|lvalue_iterator_bit)
>::type readable_lvalue_iterator_t;

typedef mpl::int_<
(lvalue_iterator_bit|writable_iterator_bit)
>::type writable_lvalue_iterator_t;

typedef mpl::int_<swappable_iterator_bit>::type swappable_iterator_t;
typedef mpl::int_<lvalue_iterator_bit>::type lvalue_iterator_t;

Expand Down Expand Up @@ -121,15 +122,15 @@ namespace detail
: mpl::eval_if<
is_convertible<TraversalCategory, random_access_traversal_tag>
, mpl::eval_if<
iterator_archetypes::has_access<
archetypes::has_access<
AccessCategory
, iterator_archetypes::writable_iterator_t
, archetypes::writable_iterator_t
>
, mpl::identity<writable_operator_brackets<Value> >
, mpl::if_<
iterator_archetypes::has_access<
archetypes::has_access<
AccessCategory
, iterator_archetypes::readable_iterator_t
, archetypes::readable_iterator_t
>
, readable_operator_brackets<Value>
, no_operator_brackets
Expand All @@ -138,7 +139,7 @@ namespace detail
, mpl::identity<no_operator_brackets>
>::type
{};

template <class TraversalCategory>
struct traversal_archetype_impl
{
Expand All @@ -156,11 +157,11 @@ namespace detail
typedef typename
traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
base;

traversal_archetype_() {}

traversal_archetype_(ctor_arg arg)
: base(arg)
: base(arg)
{}
};

Expand Down Expand Up @@ -191,23 +192,23 @@ namespace detail
explicit archetype(ctor_arg arg)
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
{}

typedef std::ptrdiff_t difference_type;
};
};

template <class Derived, class Value>
bool operator==(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&,
traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; }

template <>
struct traversal_archetype_impl<forward_traversal_tag>
{
template<class Derived, class Value>
struct archetype
: public traversal_archetype_<Derived, Value, single_pass_traversal_tag>
{
archetype()
archetype()
: traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg())
{}
};
Expand All @@ -230,7 +231,7 @@ namespace detail
{
template<class Derived, class Value>
struct archetype
: public traversal_archetype_<Derived, Value, bidirectional_traversal_tag>
: public traversal_archetype_<Derived, Value, bidirectional_traversal_tag>
{
Derived& operator+=(std::ptrdiff_t) { return static_object<Derived>::get(); }
Derived& operator-=(std::ptrdiff_t) { return static_object<Derived>::get(); }
Expand Down Expand Up @@ -289,7 +290,7 @@ namespace detail


template <class> struct undefined;

template <class AccessCategory>
struct iterator_access_archetype_impl
{
Expand All @@ -306,7 +307,7 @@ struct iterator_access_archetype

template <>
struct iterator_access_archetype_impl<
iterator_archetypes::readable_iterator_t
archetypes::readable_iterator_t
>
{
template <class Value>
Expand All @@ -324,7 +325,7 @@ struct iterator_access_archetype_impl<

template <>
struct iterator_access_archetype_impl<
iterator_archetypes::writable_iterator_t
archetypes::writable_iterator_t
>
{
template <class Value>
Expand All @@ -341,13 +342,13 @@ struct iterator_access_archetype_impl<

template <>
struct iterator_access_archetype_impl<
iterator_archetypes::readable_writable_iterator_t
archetypes::readable_writable_iterator_t
>
{
template <class Value>
struct archetype
: public virtual iterator_access_archetype<
Value, iterator_archetypes::readable_iterator_t
Value, archetypes::readable_iterator_t
>
{
typedef detail::read_write_proxy<Value> reference;
Expand All @@ -357,12 +358,12 @@ struct iterator_access_archetype_impl<
};

template <>
struct iterator_access_archetype_impl<iterator_archetypes::readable_lvalue_iterator_t>
struct iterator_access_archetype_impl<archetypes::readable_lvalue_iterator_t>
{
template <class Value>
struct archetype
: public virtual iterator_access_archetype<
Value, iterator_archetypes::readable_iterator_t
Value, archetypes::readable_iterator_t
>
{
typedef Value& reference;
Expand All @@ -371,26 +372,26 @@ struct iterator_access_archetype_impl<iterator_archetypes::readable_lvalue_itera
Value* operator->() const { return 0; }
};
};

template <>
struct iterator_access_archetype_impl<iterator_archetypes::writable_lvalue_iterator_t>
struct iterator_access_archetype_impl<archetypes::writable_lvalue_iterator_t>
{
template <class Value>
struct archetype
: public virtual iterator_access_archetype<
Value, iterator_archetypes::readable_lvalue_iterator_t
Value, archetypes::readable_lvalue_iterator_t
>
{
BOOST_STATIC_ASSERT((!is_const<Value>::value));
};
};


template <class Value, class AccessCategory, class TraversalCategory>
struct iterator_archetype;

template <class Value, class AccessCategory, class TraversalCategory>
struct traversal_archetype_base
struct traversal_archetype_base
: detail::operator_brackets<
typename remove_cv<Value>::type
, AccessCategory
Expand All @@ -412,12 +413,12 @@ namespace detail
, traversal_archetype_base<Value, AccessCategory, TraversalCategory>
{
typedef iterator_access_archetype<Value, AccessCategory> access;

typedef typename detail::facade_iterator_category<
TraversalCategory
, typename mpl::eval_if<
iterator_archetypes::has_access<
AccessCategory, iterator_archetypes::writable_iterator_t
archetypes::has_access<
AccessCategory, archetypes::writable_iterator_t
>
, remove_const<Value>
, add_const<Value>
Expand Down Expand Up @@ -450,18 +451,18 @@ struct iterator_archetype
, public detail::iterator_archetype_base<
Value, AccessCategory, TraversalCategory
>::workaround_iterator_base
# endif
# endif
{
// Derivation from std::iterator above caused references to nested
// types to be ambiguous, so now we have to redeclare them all
// here.
# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \
|| BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101))

typedef detail::iterator_archetype_base<
Value,AccessCategory,TraversalCategory
> base;

typedef typename base::value_type value_type;
typedef typename base::reference reference;
typedef typename base::pointer pointer;
Expand Down Expand Up @@ -492,7 +493,17 @@ struct iterator_archetype
# endif
};

} // namespace boost
} // namespace iterators

// Backward compatibility names
namespace iterator_archetypes = iterators::archetypes;
using iterators::access_archetype;
using iterators::traversal_archetype;
using iterators::iterator_archetype;
using iterators::undefined;
using iterators::iterator_access_archetype_impl;
using iterators::traversal_archetype_base;

} // namespace boost

#endif // BOOST_ITERATOR_ARCHETYPES_HPP
28 changes: 20 additions & 8 deletions include/boost/iterator/iterator_categories.hpp
Expand Up @@ -22,41 +22,42 @@
# include <boost/static_assert.hpp>

namespace boost {
namespace iterators {

//
// Traversal Categories
//

struct no_traversal_tag {};

struct incrementable_traversal_tag
struct incrementable_traversal_tag
: no_traversal_tag
{
// incrementable_traversal_tag() {}
// incrementable_traversal_tag(std::output_iterator_tag const&) {};
};

struct single_pass_traversal_tag
: incrementable_traversal_tag
{
// single_pass_traversal_tag() {}
// single_pass_traversal_tag(std::input_iterator_tag const&) {};
};

struct forward_traversal_tag
: single_pass_traversal_tag
{
// forward_traversal_tag() {}
// forward_traversal_tag(std::forward_iterator_tag const&) {};
};

struct bidirectional_traversal_tag
: forward_traversal_tag
{
// bidirectional_traversal_tag() {};
// bidirectional_traversal_tag(std::bidirectional_iterator_tag const&) {};
};

struct random_access_traversal_tag
: bidirectional_traversal_tag
{
Expand All @@ -65,7 +66,7 @@ struct random_access_traversal_tag
};

namespace detail
{
{
//
// Convert a "strictly old-style" iterator category to a traversal
// tag. This is broken out into a separate metafunction to reduce
Expand Down Expand Up @@ -122,7 +123,7 @@ namespace detail
>
{
};

} // namespace detail


Expand All @@ -134,7 +135,7 @@ struct iterator_category_to_traversal
: mpl::eval_if< // if already convertible to a traversal tag, we're done.
is_convertible<Cat,incrementable_traversal_tag>
, mpl::identity<Cat>
, boost::detail::old_category_to_traversal<Cat>
, boost::iterators::detail::old_category_to_traversal<Cat>
>
{};

Expand Down Expand Up @@ -165,6 +166,17 @@ struct iterator_traversal<mpl::_>
{};
# endif

} // namespace iterators

using iterators::no_traversal_tag;
using iterators::incrementable_traversal_tag;
using iterators::single_pass_traversal_tag;
using iterators::forward_traversal_tag;
using iterators::bidirectional_traversal_tag;
using iterators::random_access_traversal_tag;
using iterators::iterator_category_to_traversal;
using iterators::iterator_traversal;

} // namespace boost

#include <boost/iterator/detail/config_undef.hpp>
Expand Down
24 changes: 12 additions & 12 deletions include/boost/iterator/iterator_concepts.hpp
Expand Up @@ -56,7 +56,7 @@ namespace boost_concepts
private:
Iterator i;
};

template <
typename Iterator
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
Expand All @@ -78,7 +78,7 @@ namespace boost_concepts
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
>
struct WritableIteratorConcept : WritableIterator<Iterator,ValueType> {};

BOOST_concept(SwappableIterator,(Iterator))
{
BOOST_CONCEPT_USAGE(SwappableIterator)
Expand All @@ -93,7 +93,7 @@ namespace boost_concepts
BOOST_concept(LvalueIterator,(Iterator))
{
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;

BOOST_CONCEPT_USAGE(LvalueIterator)
{
value_type& r = const_cast<value_type&>(*i);
Expand All @@ -103,7 +103,7 @@ namespace boost_concepts
Iterator i;
};


//===========================================================================
// Iterator Traversal Concepts

Expand Down Expand Up @@ -145,7 +145,7 @@ namespace boost_concepts
, boost::DefaultConstructible<Iterator>
{
typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;

BOOST_MPL_ASSERT((boost::is_integral<difference_type>));
BOOST_MPL_ASSERT_RELATION(std::numeric_limits<difference_type>::is_signed, ==, true);

Expand All @@ -155,7 +155,7 @@ namespace boost_concepts
, boost::forward_traversal_tag
> ));
};

BOOST_concept(BidirectionalTraversal,(Iterator))
: ForwardTraversal<Iterator>
{
Expand Down Expand Up @@ -192,14 +192,14 @@ namespace boost_concepts
i = i - n;
n = i - j;
}

private:
typename BidirectionalTraversal<Iterator>::difference_type n;
Iterator i, j;
};

//===========================================================================
// Iterator Interoperability
// Iterator Interoperability

namespace detail
{
Expand Down Expand Up @@ -248,18 +248,18 @@ namespace boost_concepts
BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator))
{
private:
typedef typename boost::detail::pure_traversal_tag<
typedef typename boost::iterators::detail::pure_traversal_tag<
typename boost::iterator_traversal<
Iterator
>::type
>::type traversal_category;

typedef typename boost::detail::pure_traversal_tag<
typedef typename boost::iterators::detail::pure_traversal_tag<
typename boost::iterator_traversal<
ConstIterator
>::type
>::type const_traversal_category;

public:
BOOST_CONCEPT_ASSERT((SinglePassIterator<Iterator>));
BOOST_CONCEPT_ASSERT((SinglePassIterator<ConstIterator>));
Expand All @@ -271,7 +271,7 @@ namespace boost_concepts

ci = i;
}

private:
Iterator i;
ConstIterator ci;
Expand Down
64 changes: 35 additions & 29 deletions include/boost/iterator/iterator_facade.hpp
Expand Up @@ -38,8 +38,9 @@

#include <boost/iterator/detail/config_def.hpp> // this goes last

namespace boost
{
namespace boost {
namespace iterators {

// This forward declaration is required for the friend declaration
// in iterator_core_access
template <class I, class V, class TC, class R, class D> class iterator_facade;
Expand Down Expand Up @@ -118,7 +119,7 @@ namespace boost

// Not the real associated pointer type
typedef typename mpl::eval_if<
boost::detail::iterator_writability_disabled<ValueParam,Reference>
boost::iterators::detail::iterator_writability_disabled<ValueParam,Reference>
, add_pointer<const value_type>
, add_pointer<value_type>
>::type pointer;
Expand Down Expand Up @@ -462,15 +463,15 @@ namespace boost
# endif

# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::detail::enable_if_interoperable)
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable)

# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(prefix, op, result_type) \
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::detail::enable_if_interoperable_and_random_access_traversal)
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable_and_random_access_traversal)

# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \
template <class Derived, class V, class TC, class R, class D> \
prefix typename boost::iterators::enable_if< \
boost::detail::is_traversal_at_least< TC, boost::random_access_traversal_tag >, \
boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \
Derived \
>::type operator+ args

Expand All @@ -496,15 +497,15 @@ namespace boost
friend class detail::iterator_facade_base;

# define BOOST_ITERATOR_FACADE_RELATION(op) \
BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::detail::always_bool2);
BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::iterators::detail::always_bool2);

BOOST_ITERATOR_FACADE_RELATION(==)
BOOST_ITERATOR_FACADE_RELATION(!=)

# undef BOOST_ITERATOR_FACADE_RELATION

# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::detail::always_bool2);
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::iterators::detail::always_bool2);

BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<)
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>)
Expand All @@ -514,7 +515,7 @@ namespace boost
# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION

BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(
friend, -, boost::detail::choose_difference_type)
friend, -, boost::iterators::detail::choose_difference_type)
;

BOOST_ITERATOR_FACADE_PLUS_HEAD(
Expand Down Expand Up @@ -614,18 +615,18 @@ namespace boost
>
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
: public boost::detail::iterator_facade_types<
: public boost::iterators::detail::iterator_facade_types<
Value, CategoryOrTraversal, Reference, Difference
>::base
# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
# endif
{
private:
typedef boost::detail::iterator_facade_types<
typedef boost::iterators::detail::iterator_facade_types<
Value, CategoryOrTraversal, Reference, Difference
> associated_types;

typedef boost::detail::operator_arrow_dispatch<
typedef boost::iterators::detail::operator_arrow_dispatch<
Reference
, typename associated_types::pointer
> operator_arrow_dispatch_;
Expand Down Expand Up @@ -716,12 +717,12 @@ namespace boost
typedef typename base_type::difference_type difference_type;

public:
typename boost::detail::operator_brackets_result<Derived, Value, reference>::type
typename boost::iterators::detail::operator_brackets_result<Derived, Value, reference>::type
operator[](difference_type n) const
{
typedef boost::detail::use_operator_brackets_proxy<Value, Reference> use_proxy;
typedef boost::iterators::detail::use_operator_brackets_proxy<Value, Reference> use_proxy;

return boost::detail::make_operator_brackets_result<Derived>(
return boost::iterators::detail::make_operator_brackets_result<Derived>(
this->derived() + n
, use_proxy()
);
Expand Down Expand Up @@ -776,13 +777,13 @@ namespace boost
};

template <class I, class V, class TC, class R, class D>
inline typename boost::detail::postfix_increment_result<I,V,R,TC>::type
inline typename boost::iterators::detail::postfix_increment_result<I,V,R,TC>::type
operator++(
iterator_facade<I,V,TC,R,D>& i
, int
)
{
typename boost::detail::postfix_increment_result<I,V,R,TC>::type
typename boost::iterators::detail::postfix_increment_result<I,V,R,TC>::type
tmp(*static_cast<I*>(&i));

++i;
Expand Down Expand Up @@ -881,7 +882,7 @@ namespace boost
# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
BOOST_ITERATOR_FACADE_INTEROP( \
op \
, boost::detail::always_bool2 \
, boost::iterators::detail::always_bool2 \
, return_prefix \
, base_op \
)
Expand All @@ -898,8 +899,8 @@ namespace boost
/* For those compilers that do not support enable_if */ \
BOOST_STATIC_ASSERT(( \
is_interoperable< Derived1, Derived2 >::value && \
boost::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \
boost::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \
boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \
boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \
)); \
return_prefix iterator_core_access::base_op( \
*static_cast<Derived1 const*>(&lhs) \
Expand All @@ -911,7 +912,7 @@ namespace boost
# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
op \
, boost::detail::always_bool2 \
, boost::iterators::detail::always_bool2 \
, return_prefix \
, base_op \
)
Expand All @@ -926,7 +927,7 @@ namespace boost
// operator- requires an additional part in the static assertion
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(
-
, boost::detail::choose_difference_type
, boost::iterators::detail::choose_difference_type
, return
, distance_from
)
Expand All @@ -941,15 +942,15 @@ namespace boost
return tmp += n; \
}

BOOST_ITERATOR_FACADE_PLUS((
iterator_facade<Derived, V, TC, R, D> const& i
, typename Derived::difference_type n
))
BOOST_ITERATOR_FACADE_PLUS((
iterator_facade<Derived, V, TC, R, D> const& i
, typename Derived::difference_type n
))

BOOST_ITERATOR_FACADE_PLUS((
typename Derived::difference_type n
BOOST_ITERATOR_FACADE_PLUS((
typename Derived::difference_type n
, iterator_facade<Derived, V, TC, R, D> const& i
))
))

# undef BOOST_ITERATOR_FACADE_PLUS
# undef BOOST_ITERATOR_FACADE_PLUS_HEAD
Expand All @@ -958,6 +959,11 @@ BOOST_ITERATOR_FACADE_PLUS((
# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL

} // namespace iterators

using iterators::iterator_core_access;
using iterators::iterator_facade;

} // namespace boost

#include <boost/iterator/detail/config_undef.hpp>
Expand Down
21 changes: 15 additions & 6 deletions include/boost/iterator/iterator_traits.hpp
Expand Up @@ -8,7 +8,8 @@
# include <boost/detail/iterator.hpp>
# include <boost/detail/workaround.hpp>

namespace boost {
namespace boost {
namespace iterators {

// Macro for supporting old compilers, no longer needed but kept
// for backwards compatibility (it was documented).
Expand All @@ -20,20 +21,20 @@ struct iterator_value
{
typedef typename boost::detail::iterator_traits<Iterator>::value_type type;
};

template <class Iterator>
struct iterator_reference
{
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
};


template <class Iterator>
struct iterator_pointer
{
typedef typename boost::detail::iterator_traits<Iterator>::pointer type;
};

template <class Iterator>
struct iterator_difference
{
Expand All @@ -46,6 +47,14 @@ struct iterator_category
typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type;
};

} // namespace boost::iterator
} // namespace iterators

using iterators::iterator_value;
using iterators::iterator_reference;
using iterators::iterator_pointer;
using iterators::iterator_difference;
using iterators::iterator_category;

} // namespace boost

#endif // ITERATOR_TRAITS_DWA200347_HPP
26 changes: 15 additions & 11 deletions include/boost/iterator/permutation_iterator.hpp
Expand Up @@ -13,28 +13,28 @@
#include <boost/iterator/iterator_adaptor.hpp>


namespace boost
{
namespace boost {
namespace iterators {

template< class ElementIterator
, class IndexIterator>
class permutation_iterator
: public iterator_adaptor<
: public iterator_adaptor<
permutation_iterator<ElementIterator, IndexIterator>
, IndexIterator, typename detail::iterator_traits<ElementIterator>::value_type
, use_default, typename detail::iterator_traits<ElementIterator>::reference>
, IndexIterator, typename boost::detail::iterator_traits<ElementIterator>::value_type
, use_default, typename boost::detail::iterator_traits<ElementIterator>::reference>
{
typedef iterator_adaptor<
typedef iterator_adaptor<
permutation_iterator<ElementIterator, IndexIterator>
, IndexIterator, typename detail::iterator_traits<ElementIterator>::value_type
, use_default, typename detail::iterator_traits<ElementIterator>::reference> super_t;
, IndexIterator, typename boost::detail::iterator_traits<ElementIterator>::value_type
, use_default, typename boost::detail::iterator_traits<ElementIterator>::reference> super_t;

friend class iterator_core_access;

public:
permutation_iterator() : m_elt_iter() {}

explicit permutation_iterator(ElementIterator x, IndexIterator y)
explicit permutation_iterator(ElementIterator x, IndexIterator y)
: super_t(y), m_elt_iter(x) {}

template<class OtherElementIterator, class OtherIndexIterator>
Expand All @@ -54,18 +54,22 @@ class permutation_iterator
template <class,class> friend class permutation_iterator;
#else
public:
#endif
#endif
ElementIterator m_elt_iter;
};


template <class ElementIterator, class IndexIterator>
permutation_iterator<ElementIterator, IndexIterator>
inline permutation_iterator<ElementIterator, IndexIterator>
make_permutation_iterator( ElementIterator e, IndexIterator i )
{
return permutation_iterator<ElementIterator, IndexIterator>( e, i );
}

} // namespace iterators

using iterators::permutation_iterator;
using iterators::make_permutation_iterator;

} // namespace boost

Expand Down
15 changes: 10 additions & 5 deletions include/boost/iterator/reverse_iterator.hpp
Expand Up @@ -11,8 +11,8 @@
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_adaptor.hpp>

namespace boost
{
namespace boost {
namespace iterators {

//
//
Expand All @@ -28,7 +28,7 @@ namespace boost
public:
reverse_iterator() {}

explicit reverse_iterator(Iterator x)
explicit reverse_iterator(Iterator x)
: super_t(x) {}

template<class OtherIterator>
Expand All @@ -41,7 +41,7 @@ namespace boost

private:
typename super_t::reference dereference() const { return *boost::prior(this->base()); }

void increment() { --this->base_reference(); }
void decrement() { ++this->base_reference(); }

Expand All @@ -59,11 +59,16 @@ namespace boost
};

template <class BidirectionalIterator>
reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)
inline reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)
{
return reverse_iterator<BidirectionalIterator>(x);
}

} // namespace iterators

using iterators::reverse_iterator;
using iterators::make_reverse_iterator;

} // namespace boost

#endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP
28 changes: 17 additions & 11 deletions include/boost/iterator/transform_iterator.hpp
Expand Up @@ -26,16 +26,17 @@
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
# include <boost/type_traits/is_base_and_derived.hpp>

#endif
#endif
#include <boost/iterator/detail/config_def.hpp>


namespace boost
{
namespace boost {
namespace iterators {

template <class UnaryFunction, class Iterator, class Reference = use_default, class Value = use_default>
class transform_iterator;

namespace detail
namespace detail
{
// Compute the iterator_adaptor instantiation to be used for transform_iterator
template <class UnaryFunc, class Iterator, class Reference, class Value>
Expand Down Expand Up @@ -72,10 +73,10 @@ namespace boost

template <class UnaryFunc, class Iterator, class Reference, class Value>
class transform_iterator
: public boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
: public boost::iterators::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
{
typedef typename
boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
boost::iterators::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
super_t;

friend class iterator_core_access;
Expand All @@ -95,7 +96,7 @@ namespace boost
// don't provide this constructor if UnaryFunc is a
// function pointer type, since it will be 0. Too dangerous.
BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value);
#endif
#endif
}

template <
Expand All @@ -108,7 +109,7 @@ namespace boost
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0
#endif
#endif
)
: super_t(t.base()), m_f(t.functor())
{}
Expand All @@ -126,7 +127,7 @@ namespace boost
};

template <class UnaryFunc, class Iterator>
transform_iterator<UnaryFunc, Iterator>
inline transform_iterator<UnaryFunc, Iterator>
make_transform_iterator(Iterator it, UnaryFunc fun)
{
return transform_iterator<UnaryFunc, Iterator>(it, fun);
Expand All @@ -140,7 +141,7 @@ namespace boost
// function pointer in the iterator be 0, leading to a runtime
// crash.
template <class UnaryFunc, class Iterator>
typename iterators::enable_if<
inline typename iterators::enable_if<
is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
, transform_iterator<UnaryFunc, Iterator>
>::type
Expand All @@ -151,13 +152,18 @@ namespace boost

#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
template <class Return, class Argument, class Iterator>
transform_iterator< Return (*)(Argument), Iterator, Return>
inline transform_iterator< Return (*)(Argument), Iterator, Return>
make_transform_iterator(Iterator it, Return (*fun)(Argument))
{
return transform_iterator<Return (*)(Argument), Iterator, Return>(it, fun);
}
#endif

} // namespace iterators

using iterators::transform_iterator;
using iterators::make_transform_iterator;

} // namespace boost

#include <boost/iterator/detail/config_undef.hpp>
Expand Down
169 changes: 86 additions & 83 deletions include/boost/iterator/zip_iterator.hpp

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions include/boost/pending/detail/int_iterator.hpp
Expand Up @@ -15,6 +15,7 @@

#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
namespace boost {
namespace iterators {
#endif

// this should use random_access_iterator_helper but I've had
Expand Down Expand Up @@ -61,13 +62,19 @@ inline int_iterator<IntT>
operator+(IntT n, int_iterator<IntT> t) { t += n; return t; }

#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
} /* namespace iterators */

using iterators::int_iterator;

} /* namespace boost */
#endif

#ifdef BOOST_NO_OPERATORS_IN_NAMESPACE
namespace boost {
using ::int_iterator;
}
using ::int_iterator;
namespace iterators {
using ::int_iterator;
}}
#endif


Expand Down
27 changes: 20 additions & 7 deletions include/boost/pending/iterator_tests.hpp
Expand Up @@ -29,21 +29,22 @@
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;
};

}

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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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]);
Expand All @@ -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);
Expand All @@ -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
11 changes: 9 additions & 2 deletions include/boost/shared_container_iterator.hpp
Expand Up @@ -13,6 +13,7 @@
#include <utility>

namespace boost {
namespace iterators {

template <typename Container>
class shared_container_iterator : public iterator_adaptor<
Expand All @@ -37,7 +38,7 @@ class shared_container_iterator : public iterator_adaptor<
};

template <typename Container>
shared_container_iterator<Container>
inline shared_container_iterator<Container>
make_shared_container_iterator(typename Container::iterator iter,
boost::shared_ptr<Container> const& container) {
typedef shared_container_iterator<Container> iterator;
Expand All @@ -47,7 +48,7 @@ make_shared_container_iterator(typename Container::iterator iter,


template <typename Container>
std::pair<
inline std::pair<
shared_container_iterator<Container>,
shared_container_iterator<Container> >
make_shared_container_range(boost::shared_ptr<Container> const& container) {
Expand All @@ -57,6 +58,12 @@ make_shared_container_range(boost::shared_ptr<Container> const& container) {
make_shared_container_iterator(container->end(),container));
}

} // namespace iterators

using iterators::shared_container_iterator;
using iterators::make_shared_container_iterator;
using iterators::make_shared_container_range;

} // namespace boost

#endif // SHARED_CONTAINER_ITERATOR_RG08102002_HPP
22 changes: 11 additions & 11 deletions test/unit_tests.cpp
Expand Up @@ -29,30 +29,30 @@ void operator_arrow_test()
template <class T, class U, class Min>
struct static_assert_min_cat
: static_assert_same<
typename boost::detail::minimum_category<T,U>::type, Min
typename boost::iterators::detail::minimum_category<T,U>::type, Min
>
{};

void category_test()
{
using namespace boost;
using namespace boost::detail;
using namespace boost::iterators;
using namespace boost::iterators::detail;

BOOST_STATIC_ASSERT((
!boost::is_convertible<
std::input_iterator_tag
, input_output_iterator_tag>::value));

BOOST_STATIC_ASSERT((
!boost::is_convertible<
std::output_iterator_tag
, input_output_iterator_tag>::value));

BOOST_STATIC_ASSERT((
boost::is_convertible<
input_output_iterator_tag
, std::input_iterator_tag>::value));

BOOST_STATIC_ASSERT((
boost::is_convertible<
input_output_iterator_tag
Expand All @@ -64,7 +64,7 @@ void category_test()
boost::is_convertible<
std::forward_iterator_tag
, input_output_iterator_tag>::value));
#endif
#endif

int test = static_assert_min_cat<
std::input_iterator_tag,input_output_iterator_tag, std::input_iterator_tag
Expand All @@ -78,7 +78,7 @@ void category_test()
test = static_assert_min_cat<
input_output_iterator_tag,std::forward_iterator_tag, input_output_iterator_tag
>::value;
#endif
#endif

test = static_assert_min_cat<
std::input_iterator_tag,std::forward_iterator_tag, std::input_iterator_tag
Expand All @@ -93,8 +93,8 @@ void category_test()
test = static_assert_min_cat<
std::output_iterator_tag,std::random_access_iterator_tag, std::output_iterator_tag
>::value;
#endif
#endif

(void)test;
}

Expand Down
166 changes: 83 additions & 83 deletions test/zip_iterator_test.cpp

Large diffs are not rendered by default.