Merge upstream branch 'develop' into pr/zip_iterator/fusionize

Signed-off-by: Kohei Takahashi <flast@flast.jp>
This commit is contained in:
Kohei Takahashi
2014-07-12 15:57:03 +09:00
30 changed files with 536 additions and 370 deletions

View File

@ -14,6 +14,7 @@
#include <iterator>
namespace boost {
namespace iterators {
template <class UnaryFunction>
class function_output_iterator {
@ -33,13 +34,13 @@ namespace boost {
struct output_proxy {
output_proxy(UnaryFunction& f) : m_f(f) { }
template <class T> output_proxy& operator=(const T& value) {
m_f(value);
return *this;
m_f(value);
return *this;
}
UnaryFunction& m_f;
};
output_proxy operator*() { return output_proxy(m_f); }
self& operator++() { return *this; }
self& operator++() { return *this; }
self& operator++(int) { return *this; }
private:
UnaryFunction m_f;
@ -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
@ -33,7 +34,7 @@ class generator_iterator
, single_pass_traversal_tag
, typename Generator::result_type const&
> super_t;
public:
generator_iterator() {}
generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {}
@ -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

@ -17,7 +17,7 @@
# include <boost/mpl/eval_if.hpp>
# include <boost/pointee.hpp>
namespace boost {
namespace boost {
namespace detail
{
@ -37,7 +37,7 @@ struct indirect_reference
>
{
};
} // namespace boost
#endif // INDIRECT_REFERENCE_DWA200415_HPP

View File

@ -13,6 +13,7 @@
# include <boost/mpl/eval_if.hpp>
namespace boost {
namespace iterators {
template <
class Incrementable
@ -30,13 +31,13 @@ namespace detail
{
// For a while, this wasn't true, but we rely on it below. This is a regression assert.
BOOST_STATIC_ASSERT(::boost::is_integral<char>::value);
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<T>::is_specialized);
# else
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
BOOST_STATIC_CONSTANT(
bool, value = (
@ -46,20 +47,20 @@ namespace detail
# else
BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic<T>::value);
# endif
# endif
};
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)
template <>
struct is_numeric< ::boost::long_long_type>
: mpl::true_ {};
template <>
struct is_numeric< ::boost::ulong_long_type>
: mpl::true_ {};
@ -69,7 +70,7 @@ namespace detail
template <>
struct is_numeric<wchar_t>
: mpl::true_ {};
template <class T>
struct numeric_difference
{
@ -77,7 +78,7 @@ namespace detail
};
BOOST_STATIC_ASSERT(is_numeric<int>::value);
template <class Incrementable, class CategoryOrTraversal, class Difference>
struct counting_iterator_base
{
@ -89,7 +90,7 @@ namespace detail
, iterator_traversal<Incrementable>
>
>::type traversal;
typedef typename detail::ia_dflt_help<
Difference
, mpl::eval_if<
@ -98,7 +99,7 @@ namespace detail
, iterator_difference<Incrementable>
>
>::type difference;
typedef iterator_adaptor<
counting_iterator<Incrementable, CategoryOrTraversal, Difference> // self
, Incrementable // Base
@ -106,7 +107,7 @@ namespace detail
# ifndef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
const // MSVC won't strip this. Instead we enable Thomas'
// criterion (see boost/iterator/detail/facade_iterator_category.hpp)
# endif
# endif
, traversal
, Incrementable const& // reference
, difference
@ -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);
}
};
}
@ -154,14 +155,14 @@ class counting_iterator
typedef typename detail::counting_iterator_base<
Incrementable, CategoryOrTraversal, Difference
>::type super_t;
friend class iterator_core_access;
public:
typedef typename super_t::difference_type difference_type;
counting_iterator() { }
counting_iterator(counting_iterator const& rhs) : super_t(rhs.base()) {}
counting_iterator(Incrementable x)
@ -177,10 +178,10 @@ class counting_iterator
)
: super_t(t.base())
{}
# endif
# endif
private:
typename super_t::reference dereference() const
{
return this->base_reference();
@ -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

@ -35,7 +35,7 @@ namespace boost
typedef T type;
};
};
//
// For compilers that don't support "Substitution Failure Is Not An Error"
// enable_if falls back to always enabled. See comments
@ -70,7 +70,7 @@ namespace boost
: enabled<(Cond::value)>::template base<Return>
# else
: mpl::identity<Return>
# endif
# endif
{
};

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
@ -63,9 +66,9 @@ struct iterator_writability_disabled
, boost::detail::indirect_traits::is_reference_to_const<Reference>
, is_const<ValueParam>
>
# else
# else
: is_const<ValueParam>
# endif
# endif
{};
@ -96,7 +99,7 @@ struct iterator_facade_default_category
, typename mpl::eval_if<
mpl::and_<
is_convertible<Traversal, single_pass_traversal_tag>
// check for readability
, is_convertible<Reference, ValueParam>
>
@ -146,7 +149,7 @@ struct iterator_category_with_traversal
BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>));
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>));
# endif
# endif
};
// Computes an iterator_category tag whose traversal is Traversal and
@ -155,11 +158,11 @@ template <class Traversal, class ValueParam, class Reference>
struct facade_iterator_category_impl
{
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
typedef typename iterator_facade_default_category<
Traversal,ValueParam,Reference
>::type category;
typedef typename mpl::if_<
is_same<
Traversal
@ -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.
@ -17,7 +19,7 @@ namespace boost { namespace detail {
// For compilers not supporting is_convertible this only
// works with the new boost return and traversal category
// types. The exact boost _types_ are required. No derived types
// will work.
// will work.
//
//
template <bool GreaterEqual, bool LessEqual>
@ -25,7 +27,7 @@ struct minimum_category_impl;
template <class T1, class T2>
struct error_not_related_by_convertibility;
template <>
struct minimum_category_impl<true,false>
{
@ -66,17 +68,17 @@ struct minimum_category_impl<false,false>
template <class T1 = mpl::_1, class T2 = mpl::_2>
struct minimum_category
{
typedef minimum_category_impl<
typedef minimum_category_impl<
::boost::is_convertible<T1,T2>::value
, ::boost::is_convertible<T2,T1>::value
> outer;
typedef typename outer::template apply<T1,T2> inner;
typedef typename inner::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2))
};
template <>
struct minimum_category<mpl::_1,mpl::_2>
{
@ -86,7 +88,16 @@ struct minimum_category<mpl::_1,mpl::_2>
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2))
};
}} // namespace boost::detail
} // namespace detail
} // namespace iterators
// This import below is for backward compatibility with boost/token_iterator.hpp.
// It should be removed as soon as that header is fixed.
namespace detail {
using iterators::detail::minimum_category;
} // namespace detail
} // namespace boost
#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;
@ -39,7 +40,7 @@ namespace boost
> type;
};
}
template <class Predicate, class Iterator>
class filter_iterator
: public detail::filter_iterator_base<Predicate, Iterator>::type
@ -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();
}
@ -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>
@ -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() {
@ -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();
}
@ -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>,
@ -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

@ -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;
@ -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
@ -69,7 +70,7 @@ namespace boost
struct indirect_base<int, int, int, int, int> {};
} // namespace detail
template <
class Iterator
, class Value = use_default
@ -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
}
};
@ -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
@ -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.
//
@ -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>

View File

@ -18,7 +18,9 @@
#ifndef BOOST_NO_IS_CONVERTIBLE
namespace boost {
namespace iterators {
namespace detail
{
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
@ -26,20 +28,20 @@ namespace detail
// 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.
@ -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 = (
@ -75,7 +77,7 @@ namespace detail
};
#undef BOOST_LVALUE_PRESERVER
//
// void specializations to handle std input and output iterators
//
@ -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

View File

@ -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
@ -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 = (
@ -44,7 +46,7 @@ namespace detail
};
#undef BOOST_READABLE_PRESERVER
//
// void specializations to handle std input and output iterators
//
@ -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

View File

@ -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.
@ -73,7 +78,7 @@ namespace boost
// public iterator_adaptor< adapted_iterator<Iterator>, Iterator >
// {
// public:
//
//
// ...
//
// template <class OtherIterator>
@ -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>
@ -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
//
@ -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>
@ -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,13 +200,13 @@ 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 ()
@ -209,7 +214,7 @@ namespace boost
BOOST_STATIC_ASSERT((is_convertible<Tr1, Tr2>::value));
}
}
//
// Iterator Adaptor
//
@ -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:
@ -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
//
@ -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
@ -307,17 +312,17 @@ 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;
@ -325,7 +330,7 @@ namespace boost
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
{
@ -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>

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
@ -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;
@ -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
@ -138,7 +139,7 @@ namespace detail
, mpl::identity<no_operator_brackets>
>::type
{};
template <class TraversalCategory>
struct traversal_archetype_impl
{
@ -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)
{}
};
@ -191,7 +192,7 @@ namespace detail
explicit archetype(ctor_arg arg)
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
{}
typedef std::ptrdiff_t difference_type;
};
};
@ -199,7 +200,7 @@ namespace detail
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>
{
@ -207,7 +208,7 @@ namespace detail
struct archetype
: public traversal_archetype_<Derived, Value, single_pass_traversal_tag>
{
archetype()
archetype()
: traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg())
{}
};
@ -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(); }
@ -289,7 +290,7 @@ namespace detail
template <class> struct undefined;
template <class AccessCategory>
struct iterator_access_archetype_impl
{
@ -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;
@ -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
@ -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>
@ -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;
@ -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
@ -29,34 +30,34 @@ namespace boost {
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
{
@ -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
@ -122,7 +123,7 @@ namespace detail
>
{
};
} // namespace detail
@ -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

@ -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
@ -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)
@ -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);
@ -103,7 +103,7 @@ namespace boost_concepts
Iterator i;
};
//===========================================================================
// Iterator Traversal Concepts
@ -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);
@ -155,7 +155,7 @@ namespace boost_concepts
, boost::forward_traversal_tag
> ));
};
BOOST_concept(BidirectionalTraversal,(Iterator))
: ForwardTraversal<Iterator>
{
@ -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
{
@ -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>));
@ -271,7 +271,7 @@ namespace boost_concepts
ci = i;
}
private:
Iterator i;
ConstIterator ci;

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

@ -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).
@ -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
{
@ -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,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>
@ -54,18 +54,22 @@ private:
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

View File

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

@ -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>
@ -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;
@ -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 <
@ -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())
{}
@ -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

@ -36,6 +36,7 @@
#include <boost/fusion/support/tag_of_fwd.hpp>
namespace boost {
namespace iterators {
// Zip iterator forward declaration for zip_iterator_base
template<typename IteratorTuple>
@ -357,6 +358,11 @@ namespace boost {
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

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

View File

@ -20,7 +20,7 @@
# include <boost/mpl/if.hpp>
# include <boost/mpl/eval_if.hpp>
namespace boost {
namespace boost {
namespace detail
{
@ -34,25 +34,25 @@ namespace detail
struct iterator_pointee
{
typedef typename iterator_traits<Iterator>::value_type value_type;
struct impl
{
template <class T>
static char test(T const&);
static char (& test(value_type&) )[2];
static Iterator& x;
};
BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1);
typedef typename mpl::if_c<
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
::boost::detail::iterator_pointee<Iterator>::is_constant
# else
is_constant
# endif
# endif
, typename add_const<value_type>::type
, value_type
>::type type;
@ -68,7 +68,7 @@ struct pointee
>
{
};
} // namespace boost
#endif // POINTEE_DWA200415_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,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
@ -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
@ -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
@ -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;
}

View File

@ -4,7 +4,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
// File:
// File:
// =====
// zip_iterator_test_main.cpp
@ -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
>
{};
@ -82,13 +82,13 @@ void category_test()
);
}
///
/////////////////////////////////////////////////////////////////////////////
//
// Das Main Funktion
//
/////////////////////////////////////////////////////////////////////////////
int main( void )
{
@ -105,16 +105,16 @@ int main( void )
size_t num_successful_tests = 0;
size_t num_failed_tests = 0;
/////////////////////////////////////////////////////////////////////////////
//
// Zip iterator construction and dereferencing
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator construction and dereferencing: "
<< std::flush;
std::vector<double> vect1(3);
vect1[0] = 42.;
vect1[1] = 43.;
@ -141,9 +141,9 @@ int main( void )
)
);
boost::tuples::tuple<int, double> val_tuple(
boost::tuples::tuple<int, double> val_tuple(
*zip_it_mixed);
boost::tuples::tuple<const int&, double&> ref_tuple(
*zip_it_mixed);
@ -177,7 +177,7 @@ int main( void )
std::cout << "Zip iterators with 12 components: "
<< std::flush;
// Declare 12 containers
//
std::list<int> li1;
@ -210,30 +210,30 @@ int main( void )
// typedefs for cons lists of iterators.
typedef boost::tuples::cons<
std::set<int>::iterator,
std::set<int>::iterator,
boost::tuples::tuple<
std::vector<int>::iterator,
std::list<int>::iterator,
std::set<int>::iterator,
std::list<int>::iterator,
std::set<int>::iterator,
std::vector<int>::iterator,
std::list<int>::iterator,
std::set<int>::iterator,
std::list<int>::iterator,
std::set<int>::iterator,
std::vector<int>::iterator,
std::list<int>::iterator,
std::set<int>::iterator,
std::list<int>::iterator,
std::set<int>::iterator,
std::vector<int>::const_iterator
>::inherited
> cons_11_its_type;
//
typedef boost::tuples::cons<
std::list<int>::const_iterator,
std::list<int>::const_iterator,
cons_11_its_type
> cons_12_its_type;
// typedefs for cons lists for dereferencing the zip iterator
// made from the cons list above.
typedef boost::tuples::cons<
const int&,
const int&,
boost::tuples::tuple<
int&,
int&,
@ -249,7 +249,7 @@ int main( void )
> cons_11_refs_type;
//
typedef boost::tuples::cons<
const int&,
const int&,
cons_11_refs_type
> cons_12_refs_type;
@ -259,19 +259,19 @@ int main( void )
// Declare a 12-element zip iterator.
zip_it_12_type zip_it_12(
cons_12_its_type(
li1.begin(),
li1.begin(),
cons_11_its_type(
se1.begin(),
boost::make_tuple(
ve1.begin(),
li2.begin(),
se2.begin(),
li2.begin(),
se2.begin(),
ve2.begin(),
li3.begin(),
se3.begin(),
li3.begin(),
se3.begin(),
ve3.begin(),
li4.begin(),
se4.begin(),
li4.begin(),
se4.begin(),
ve4.begin()
)
)
@ -281,7 +281,7 @@ int main( void )
// Dereference, mess with the result a little.
cons_12_refs_type zip_it_12_dereferenced(*zip_it_12);
boost::tuples::get<9>(zip_it_12_dereferenced) = 42;
// Make a copy and move it a little to force some instantiations.
zip_it_12_type zip_it_12_copy(zip_it_12);
++zip_it_12_copy;
@ -315,12 +315,12 @@ int main( void )
vect2[0] = 2.2;
vect2[1] = 3.3;
vect2[2] = 4.4;
boost::zip_iterator<
boost::tuples::tuple<
std::vector<double>::const_iterator,
std::vector<double>::const_iterator,
std::vector<double>::const_iterator
>
>
>
zip_it_begin(
boost::make_tuple(
@ -331,9 +331,9 @@ int main( void )
boost::zip_iterator<
boost::tuples::tuple<
std::vector<double>::const_iterator,
std::vector<double>::const_iterator,
std::vector<double>::const_iterator
>
>
>
zip_it_run(
boost::make_tuple(
@ -344,9 +344,9 @@ int main( void )
boost::zip_iterator<
boost::tuples::tuple<
std::vector<double>::const_iterator,
std::vector<double>::const_iterator,
std::vector<double>::const_iterator
>
>
>
zip_it_end(
boost::make_tuple(
@ -379,7 +379,7 @@ int main( void )
// Zip iterator decrementing and dereferencing
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator -- and *: "
<< std::flush;
@ -408,13 +408,13 @@ int main( void )
// Zip iterator copy construction and equality
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator copy construction and equality: "
std::cout << "Zip iterator copy construction and equality: "
<< std::flush;
boost::zip_iterator<
boost::tuples::tuple<
std::vector<double>::const_iterator,
std::vector<double>::const_iterator,
std::vector<double>::const_iterator
>
> zip_it_run_copy(zip_it_run);
@ -435,10 +435,10 @@ int main( void )
// Zip iterator inequality
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator inequality: "
<< std::flush;
if(!(zip_it_run != zip_it_run_copy) && zip_it_run != ++zip_it_run_copy)
{
++num_successful_tests;
@ -455,14 +455,14 @@ int main( void )
// Zip iterator less than
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator less than: "
<< std::flush;
// Note: zip_it_run_copy == zip_it_run + 1
//
if( zip_it_run < zip_it_run_copy &&
!( zip_it_run < --zip_it_run_copy) &&
!( zip_it_run < --zip_it_run_copy) &&
zip_it_run == zip_it_run_copy
)
{
@ -480,18 +480,18 @@ int main( void )
// Zip iterator less than or equal
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "zip iterator less than or equal: "
<< std::flush;
// Note: zip_it_run_copy == zip_it_run
//
++zip_it_run;
zip_it_run_copy += 2;
if( zip_it_run <= zip_it_run_copy &&
zip_it_run <= --zip_it_run_copy &&
!( zip_it_run <= --zip_it_run_copy) &&
if( zip_it_run <= zip_it_run_copy &&
zip_it_run <= --zip_it_run_copy &&
!( zip_it_run <= --zip_it_run_copy) &&
zip_it_run <= zip_it_run
)
{
@ -509,14 +509,14 @@ int main( void )
// Zip iterator greater than
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator greater than: "
<< std::flush;
// Note: zip_it_run_copy == zip_it_run - 1
//
if( zip_it_run > zip_it_run_copy &&
!( zip_it_run > ++zip_it_run_copy) &&
if( zip_it_run > zip_it_run_copy &&
!( zip_it_run > ++zip_it_run_copy) &&
zip_it_run == zip_it_run_copy
)
{
@ -534,17 +534,17 @@ int main( void )
// Zip iterator greater than or equal
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator greater than or equal: "
<< std::flush;
++zip_it_run;
// Note: zip_it_run == zip_it_run_copy + 1
//
if( zip_it_run >= zip_it_run_copy &&
--zip_it_run >= zip_it_run_copy &&
! (zip_it_run >= ++zip_it_run_copy)
if( zip_it_run >= zip_it_run_copy &&
--zip_it_run >= zip_it_run_copy &&
! (zip_it_run >= ++zip_it_run_copy)
)
{
++num_successful_tests;
@ -589,13 +589,13 @@ int main( void )
std::cout << "Zip iterator - int: "
<< std::flush;
// Note: zip_it_run == zip_it_run_copy, and both are at end position
//
//
zip_it_run = zip_it_run - 2;
--zip_it_run_copy;
--zip_it_run_copy;
if( zip_it_run == zip_it_run_copy && (zip_it_run - 1) == zip_it_begin )
{
++num_successful_tests;
@ -612,12 +612,12 @@ int main( void )
// Zip iterator +=
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator +=: "
<< std::flush;
// Note: zip_it_run == zip_it_run_copy, and both are at begin + 1
//
//
zip_it_run += 2;
if( zip_it_run == zip_it_begin + 3 )
{
@ -641,7 +641,7 @@ int main( void )
// Note: zip_it_run is at end position, zip_it_run_copy is at
// begin plus one.
//
//
zip_it_run -= 2;
if( zip_it_run == zip_it_run_copy )
{
@ -659,13 +659,13 @@ int main( void )
// Zip iterator getting member iterators
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator member iterators: "
<< std::flush;
// Note: zip_it_run and zip_it_run_copy are both at
// begin plus one.
//
//
if( boost::tuples::get<0>(zip_it_run.get_iterator_tuple()) == vect1.begin() + 1 &&
boost::tuples::get<1>(zip_it_run.get_iterator_tuple()) == vect2.begin() + 1
)
@ -684,7 +684,7 @@ int main( void )
// Making zip iterators
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Making zip iterators: "
<< std::flush;
@ -694,13 +694,13 @@ int main( void )
std::copy(
boost::make_zip_iterator(
boost::make_tuple(
vect1.begin(),
vect1.begin(),
vect2.begin()
)
),
boost::make_zip_iterator(
boost::make_tuple(
vect1.end(),
vect1.end(),
vect2.end()
)
),
@ -729,19 +729,19 @@ int main( void )
// Zip iterator non-const --> const conversion
//
/////////////////////////////////////////////////////////////////////////////
std::cout << "Zip iterator non-const to const conversion: "
<< std::flush;
boost::zip_iterator<
boost::tuples::tuple<
std::set<int>::const_iterator,
std::vector<double>::const_iterator
>
>
>
zip_it_const(
boost::make_tuple(
intset.begin(),
intset.begin(),
vect2.begin()
)
);
@ -751,10 +751,10 @@ int main( void )
std::set<int>::iterator,
std::vector<double>::const_iterator
>
>
>
zip_it_half_const(
boost::make_tuple(
intset.begin(),
intset.begin(),
vect2.begin()
)
);
@ -764,10 +764,10 @@ int main( void )
std::set<int>::iterator,
std::vector<double>::iterator
>
>
>
zip_it_non_const(
boost::make_tuple(
intset.begin(),
intset.begin(),
vect2.begin()
)
);
@ -776,7 +776,7 @@ int main( void )
zip_it_const = zip_it_half_const;
++zip_it_const;
// zip_it_non_const = ++zip_it_const; // Error: can't convert from const to non-const
if( 54 == boost::tuples::get<0>(*zip_it_const) &&
4.4 == boost::tuples::get<1>(*zip_it_const) &&
53 == boost::tuples::get<0>(*zip_it_half_const) &&
@ -801,7 +801,7 @@ int main( void )
std::cout << "Zip iterator categories: "
<< std::flush;
// The big iterator of the previous test has vector, list, and set iterators.
// Therefore, it must be bidirectional, but not random access.
bool bBigItIsBidirectionalIterator = boost::is_convertible<
@ -819,11 +819,11 @@ int main( void )
//
typedef boost::zip_iterator<
boost::tuples::tuple<
std::vector<double>::const_iterator,
std::vector<double>::const_iterator,
std::vector<double>::const_iterator
>
> all_vects_type;
bool bAllVectsIsRandomAccessIterator = boost::is_convertible<
boost::iterator_traversal<all_vects_type>::type
, boost::random_access_traversal_tag