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

@ -14,6 +14,7 @@
#include <iterator>
namespace boost {
namespace iterators {
template <class UnaryFunction>
class function_output_iterator {
@ -51,6 +52,11 @@ namespace boost {
return function_output_iterator<UnaryFunction>(f);
}
} // namespace iterators
using iterators::function_output_iterator;
using iterators::make_function_output_iterator;
} // namespace boost
#endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP

View File

@ -17,6 +17,7 @@
#include <boost/ref.hpp>
namespace boost {
namespace iterators {
template<class Generator>
class generator_iterator
@ -73,8 +74,12 @@ make_generator_iterator(Generator & gen)
return result_t(&gen);
}
} // namespace iterators
using iterators::generator_iterator;
using iterators::generator_iterator_generator;
using iterators::make_generator_iterator;
} // namespace boost
#endif // BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP

View File

@ -13,6 +13,7 @@
# include <boost/mpl/eval_if.hpp>
namespace boost {
namespace iterators {
template <
class Incrementable
@ -52,7 +53,7 @@ namespace detail
template <class T>
struct is_numeric
: mpl::bool_<(::boost::detail::is_numeric_impl<T>::value)>
: mpl::bool_<(::boost::iterators::detail::is_numeric_impl<T>::value)>
{};
# if defined(BOOST_HAS_LONG_LONG)
@ -136,7 +137,7 @@ namespace detail
{
static Difference distance(Incrementable1 x, Incrementable2 y)
{
return numeric_distance(x, y);
return boost::detail::numeric_distance(x, y);
}
};
}
@ -209,7 +210,11 @@ make_counting_iterator(Incrementable x)
return result_t(x);
}
} // namespace iterators
} // namespace boost::iterator
using iterators::counting_iterator;
using iterators::make_counting_iterator;
} // namespace boost
#endif // COUNTING_ITERATOR_DWA200348_HPP

View File

@ -4,7 +4,9 @@
#ifndef ANY_CONVERSION_EATER_DWA20031117_HPP
# define ANY_CONVERSION_EATER_DWA20031117_HPP
namespace boost { namespace detail {
namespace boost {
namespace iterators {
namespace detail {
// This type can be used in traits to "eat" up the one user-defined
// implicit conversion allowed.
@ -14,6 +16,6 @@ struct any_conversion_eater
any_conversion_eater(T const&);
};
}} // namespace boost::detail
}}} // namespace boost::iterators::detail
#endif // ANY_CONVERSION_EATER_DWA20031117_HPP

View File

@ -30,10 +30,13 @@
// iterator_category deduction for iterator_facade
//
// forward declaration
namespace boost { struct use_default; }
namespace boost {
namespace iterators {
namespace boost { namespace detail {
// forward declaration
struct use_default;
namespace detail {
struct input_output_iterator_tag
: std::input_iterator_tag
@ -183,7 +186,7 @@ struct facade_iterator_category
{
};
}} // namespace boost::detail
}}} // namespace boost::iterators::detail
# include <boost/iterator/detail/config_undef.hpp>

View File

@ -9,7 +9,9 @@
# include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace detail {
namespace boost {
namespace iterators {
namespace detail {
//
// Returns the minimum category type or error_type
// if T1 and T2 are unrelated.
@ -87,6 +89,6 @@ struct minimum_category<mpl::_1,mpl::_2>
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2))
};
}} // namespace boost::detail
}}} // namespace boost::iterators::detail
#endif // MINIMUM_CATEGORY_DWA20031119_HPP

View File

@ -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;
@ -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>
@ -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

View File

@ -20,6 +20,8 @@
namespace boost {
namespace iterators {
namespace impl {
template <class Function, class Input>
@ -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

View File

@ -34,8 +34,9 @@
#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;
@ -44,7 +45,7 @@ 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>
@ -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>

View File

@ -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
@ -43,6 +43,10 @@ namespace boost
{
};
} // namespace iterators
using iterators::is_interoperable;
} // namespace boost
# include <boost/iterator/detail/config_undef.hpp>

View File

@ -19,6 +19,8 @@
namespace boost {
namespace iterators {
namespace detail
{
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
@ -135,10 +137,15 @@ 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

View File

@ -17,6 +17,8 @@
namespace boost {
namespace iterators {
namespace detail
{
// Guts of is_readable_iterator. Value is the iterator's value_type
@ -97,7 +99,11 @@ 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

View File

@ -31,21 +31,26 @@
#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
{
@ -104,7 +109,7 @@ namespace boost
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))
@ -118,7 +123,7 @@ namespace boost
is_same<From,To>
, is_convertible<From, To>
>
, boost::detail::enable_type
, boost::iterators::detail::enable_type
>
{};
@ -128,7 +133,7 @@ namespace boost
struct enable_if_convertible
: iterators::enable_if<
is_convertible<From, To>
, boost::detail::enable_type
, boost::iterators::detail::enable_type
>
{};
@ -167,7 +172,7 @@ namespace boost
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>
@ -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>
@ -195,7 +200,7 @@ namespace boost
>
>::type
, typename boost::detail::ia_dflt_help<
, typename boost::iterators::detail::ia_dflt_help<
Difference, iterator_difference<Base>
>::type
>
@ -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:
@ -307,7 +312,7 @@ 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)
{
@ -343,6 +348,11 @@ namespace boost
Base m_iterator;
};
} // namespace iterators
using iterators::iterator_adaptor;
using iterators::enable_if_convertible;
} // namespace boost
#include <boost/iterator/detail/config_undef.hpp>

View File

@ -31,6 +31,7 @@
#include <cstddef>
namespace boost {
namespace iterators {
template <class Value, class AccessCategory>
struct access_archetype;
@ -38,7 +39,7 @@ 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
@ -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
@ -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>
@ -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>
@ -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;
@ -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;
@ -373,12 +374,12 @@ struct iterator_access_archetype_impl<iterator_archetypes::readable_lvalue_itera
};
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));
@ -416,8 +417,8 @@ namespace detail
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>
@ -492,7 +493,17 @@ struct iterator_archetype
# endif
};
} // 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

View File

@ -22,6 +22,7 @@
# include <boost/static_assert.hpp>
namespace boost {
namespace iterators {
//
// Traversal Categories
@ -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>
>
{};
@ -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>

View File

@ -248,13 +248,13 @@ 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

View File

@ -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;
@ -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;
@ -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
@ -496,7 +497,7 @@ 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(!=)
@ -504,7 +505,7 @@ namespace boost
# 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(>)
@ -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(
@ -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_;
@ -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()
);
@ -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;
@ -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 \
)
@ -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) \
@ -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 \
)
@ -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
)
@ -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
@ -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>

View File

@ -9,6 +9,7 @@
# include <boost/detail/workaround.hpp>
namespace boost {
namespace iterators {
// Macro for supporting old compilers, no longer needed but kept
// for backwards compatibility (it was documented).
@ -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

View File

@ -13,21 +13,21 @@
#include <boost/iterator/iterator_adaptor.hpp>
namespace boost
{
namespace boost {
namespace iterators {
template< class ElementIterator
, class IndexIterator>
class permutation_iterator
: 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<
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;
@ -60,12 +60,16 @@ private:
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

View File

@ -11,8 +11,8 @@
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
namespace boost
{
namespace boost {
namespace iterators {
//
//
@ -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

View File

@ -30,8 +30,9 @@
#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;
@ -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;
@ -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);
@ -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
@ -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>

View File

@ -27,6 +27,7 @@
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost {
namespace iterators {
// Zip iterator forward declaration for zip_iterator_base
template<typename IteratorTuple>
@ -89,7 +90,7 @@ namespace boost {
struct apply
{
typedef typename
iterator_traits<Iterator>::reference
boost::detail::iterator_traits<Iterator>::reference
type;
};
@ -211,12 +212,12 @@ namespace boost {
// Arg* operator()(Arg x);
// };
template<typename Fun>
tuples::null_type BOOST_TUPLE_ALGO(tuple_transform)
inline tuples::null_type BOOST_TUPLE_ALGO(tuple_transform)
(tuples::null_type const&, Fun BOOST_TUPLE_ALGO_TERMINATOR)
{ return tuples::null_type(); }
template<typename Tuple, typename Fun>
typename tuple_meta_transform<
inline typename tuple_meta_transform<
Tuple
, Fun
>::type
@ -244,7 +245,7 @@ namespace boost {
#ifdef BOOST_TUPLE_ALGO_DISPATCH
template<typename Tuple, typename Fun>
typename tuple_meta_transform<
inline typename tuple_meta_transform<
Tuple
, Fun
>::type
@ -261,7 +262,7 @@ namespace boost {
// for_each algorithm for tuples.
//
template<typename Fun>
Fun BOOST_TUPLE_ALGO(tuple_for_each)(
inline Fun BOOST_TUPLE_ALGO(tuple_for_each)(
tuples::null_type
, Fun f BOOST_TUPLE_ALGO_TERMINATOR
)
@ -269,7 +270,7 @@ namespace boost {
template<typename Tuple, typename Fun>
Fun BOOST_TUPLE_ALGO(tuple_for_each)(
inline Fun BOOST_TUPLE_ALGO(tuple_for_each)(
Tuple& t
, Fun f BOOST_TUPLE_ALGO_RECURSE)
{
@ -279,7 +280,7 @@ namespace boost {
#ifdef BOOST_TUPLE_ALGO_DISPATCH
template<typename Tuple, typename Fun>
Fun
inline Fun
tuple_for_each(
Tuple& t,
Fun f
@ -298,10 +299,7 @@ namespace boost {
{ return true; }
template<typename Tuple1, typename Tuple2>
bool tuple_equal(
Tuple1 const& t1,
Tuple2 const& t2
)
inline bool tuple_equal(Tuple1 const& t1, Tuple2 const& t2)
{
return t1.get_head() == t2.get_head() &&
tuple_equal(t1.get_tail(), t2.get_tail());
@ -313,7 +311,7 @@ namespace boost {
template<typename Iterator>
struct iterator_reference
{
typedef typename iterator_traits<Iterator>::reference type;
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
};
#ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
@ -403,7 +401,7 @@ namespace boost {
typedef reference value_type;
// Difference type is the first iterator's difference type
typedef typename iterator_traits<
typedef typename boost::detail::iterator_traits<
typename tuples::element<0, IteratorTuple>::type
>::difference_type difference_type;
@ -561,10 +559,15 @@ namespace boost {
// Make function for zip iterator
//
template<typename IteratorTuple>
zip_iterator<IteratorTuple>
inline zip_iterator<IteratorTuple>
make_zip_iterator(IteratorTuple t)
{ return zip_iterator<IteratorTuple>(t); }
}
} // namespace iterators
using iterators::zip_iterator;
using iterators::make_zip_iterator;
} // namespace boost
#endif

View File

@ -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
@ -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

View File

@ -41,6 +41,7 @@ struct dummyT {
}
namespace boost {
namespace iterators {
// Tests whether type Iterator satisfies the requirements for a
// TrivialIterator.
@ -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

View File

@ -13,6 +13,7 @@
#include <utility>
namespace boost {
namespace iterators {
template <typename Container>
class shared_container_iterator : public iterator_adaptor<
@ -37,7 +38,7 @@ public:
};
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;
@ -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) {
@ -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

View File

@ -29,14 +29,14 @@ 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<

View File

@ -57,7 +57,7 @@
template <class It>
struct pure_traversal
: boost::detail::pure_traversal_tag<
: boost::iterators::detail::pure_traversal_tag<
typename boost::iterator_traversal<It>::type
>
{};