forked from boostorg/iterator
Merge pull request #4 from Lastique/sfinae-based-operators
Make iterator operators conditionally defined depending on its category. Looks okay and fixes several known problems, thanks Andrey.
This commit is contained in:
0
doc/BidirectionalTraversal.rst
Executable file → Normal file
0
doc/BidirectionalTraversal.rst
Executable file → Normal file
0
doc/ForwardTraversal.rst
Executable file → Normal file
0
doc/ForwardTraversal.rst
Executable file → Normal file
0
doc/GNUmakefile
Executable file → Normal file
0
doc/GNUmakefile
Executable file → Normal file
0
doc/IncrementableIterator.rst
Executable file → Normal file
0
doc/IncrementableIterator.rst
Executable file → Normal file
0
doc/LvalueIterator.rst
Executable file → Normal file
0
doc/LvalueIterator.rst
Executable file → Normal file
0
doc/ReadableIterator.rst
Executable file → Normal file
0
doc/ReadableIterator.rst
Executable file → Normal file
0
doc/SinglePassIterator.rst
Executable file → Normal file
0
doc/SinglePassIterator.rst
Executable file → Normal file
0
doc/SwappableIterator.rst
Executable file → Normal file
0
doc/SwappableIterator.rst
Executable file → Normal file
0
doc/WritableIterator.rst
Executable file → Normal file
0
doc/WritableIterator.rst
Executable file → Normal file
0
doc/counting_iterator.pdf
Executable file → Normal file
0
doc/counting_iterator.pdf
Executable file → Normal file
0
doc/docutils.sty
Executable file → Normal file
0
doc/docutils.sty
Executable file → Normal file
0
doc/facade-and-adaptor.pdf
Executable file → Normal file
0
doc/facade-and-adaptor.pdf
Executable file → Normal file
0
doc/facade_iterator_category.rst
Executable file → Normal file
0
doc/facade_iterator_category.rst
Executable file → Normal file
0
doc/filter_iterator.pdf
Executable file → Normal file
0
doc/filter_iterator.pdf
Executable file → Normal file
0
doc/function_output_iterator.pdf
Executable file → Normal file
0
doc/function_output_iterator.pdf
Executable file → Normal file
0
doc/indirect_iterator.pdf
Executable file → Normal file
0
doc/indirect_iterator.pdf
Executable file → Normal file
0
doc/indirect_reference_ref.rst
Executable file → Normal file
0
doc/indirect_reference_ref.rst
Executable file → Normal file
0
doc/interoperability-revisited.rst
Executable file → Normal file
0
doc/interoperability-revisited.rst
Executable file → Normal file
0
doc/iterator_adaptor.pdf
Executable file → Normal file
0
doc/iterator_adaptor.pdf
Executable file → Normal file
0
doc/iterator_adaptor_tutorial.rst
Executable file → Normal file
0
doc/iterator_adaptor_tutorial.rst
Executable file → Normal file
0
doc/iterator_archetypes.html
Executable file → Normal file
0
doc/iterator_archetypes.html
Executable file → Normal file
0
doc/iterator_archetypes.pdf
Executable file → Normal file
0
doc/iterator_archetypes.pdf
Executable file → Normal file
0
doc/iterator_archetypes.rst
Executable file → Normal file
0
doc/iterator_archetypes.rst
Executable file → Normal file
0
doc/iterator_concepts.pdf
Executable file → Normal file
0
doc/iterator_concepts.pdf
Executable file → Normal file
0
doc/iterator_concepts.rst
Executable file → Normal file
0
doc/iterator_concepts.rst
Executable file → Normal file
0
doc/iterator_facade.pdf
Executable file → Normal file
0
doc/iterator_facade.pdf
Executable file → Normal file
0
doc/iterator_facade_tutorial.rst
Executable file → Normal file
0
doc/iterator_facade_tutorial.rst
Executable file → Normal file
0
doc/iterator_traits.html
Executable file → Normal file
0
doc/iterator_traits.html
Executable file → Normal file
0
doc/iterator_traits.pdf
Executable file → Normal file
0
doc/iterator_traits.pdf
Executable file → Normal file
0
doc/iterator_traits.rst
Executable file → Normal file
0
doc/iterator_traits.rst
Executable file → Normal file
0
doc/make_counting_iterator.rst
Executable file → Normal file
0
doc/make_counting_iterator.rst
Executable file → Normal file
0
doc/make_filter_iterator.rst
Executable file → Normal file
0
doc/make_filter_iterator.rst
Executable file → Normal file
0
doc/make_transform_iterator.rst
Executable file → Normal file
0
doc/make_transform_iterator.rst
Executable file → Normal file
0
doc/make_zip_iterator.rst
Executable file → Normal file
0
doc/make_zip_iterator.rst
Executable file → Normal file
0
doc/new-iter-concepts.pdf
Executable file → Normal file
0
doc/new-iter-concepts.pdf
Executable file → Normal file
0
doc/permutation_iterator.pdf
Executable file → Normal file
0
doc/permutation_iterator.pdf
Executable file → Normal file
0
doc/pointee.html
Executable file → Normal file
0
doc/pointee.html
Executable file → Normal file
0
doc/pointee.pdf
Executable file → Normal file
0
doc/pointee.pdf
Executable file → Normal file
0
doc/pointee.rst
Executable file → Normal file
0
doc/pointee.rst
Executable file → Normal file
0
doc/pointee_ref.rst
Executable file → Normal file
0
doc/pointee_ref.rst
Executable file → Normal file
0
doc/reverse_iterator.pdf
Executable file → Normal file
0
doc/reverse_iterator.pdf
Executable file → Normal file
0
doc/transform_iterator.pdf
Executable file → Normal file
0
doc/transform_iterator.pdf
Executable file → Normal file
0
doc/transform_iterator_eg.rst
Executable file → Normal file
0
doc/transform_iterator_eg.rst
Executable file → Normal file
0
doc/zip_iterator.html
Executable file → Normal file
0
doc/zip_iterator.html
Executable file → Normal file
0
doc/zip_iterator.pdf
Executable file → Normal file
0
doc/zip_iterator.pdf
Executable file → Normal file
0
doc/zip_iterator.rst
Executable file → Normal file
0
doc/zip_iterator.rst
Executable file → Normal file
0
doc/zip_iterator_abstract.rst
Executable file → Normal file
0
doc/zip_iterator_abstract.rst
Executable file → Normal file
0
doc/zip_iterator_eg.rst
Executable file → Normal file
0
doc/zip_iterator_eg.rst
Executable file → Normal file
0
doc/zip_iterator_ref.rst
Executable file → Normal file
0
doc/zip_iterator_ref.rst
Executable file → Normal file
0
example/node.hpp
Executable file → Normal file
0
example/node.hpp
Executable file → Normal file
0
example/node_iterator1.cpp
Executable file → Normal file
0
example/node_iterator1.cpp
Executable file → Normal file
0
example/node_iterator1.hpp
Executable file → Normal file
0
example/node_iterator1.hpp
Executable file → Normal file
0
example/node_iterator2.cpp
Executable file → Normal file
0
example/node_iterator2.cpp
Executable file → Normal file
0
example/node_iterator2.hpp
Executable file → Normal file
0
example/node_iterator2.hpp
Executable file → Normal file
0
example/node_iterator3.cpp
Executable file → Normal file
0
example/node_iterator3.cpp
Executable file → Normal file
0
example/node_iterator3.hpp
Executable file → Normal file
0
example/node_iterator3.hpp
Executable file → Normal file
0
include/boost/iterator/detail/any_conversion_eater.hpp
Executable file → Normal file
0
include/boost/iterator/detail/any_conversion_eater.hpp
Executable file → Normal file
0
include/boost/iterator/is_lvalue_iterator.hpp
Executable file → Normal file
0
include/boost/iterator/is_lvalue_iterator.hpp
Executable file → Normal file
0
include/boost/iterator/is_readable_iterator.hpp
Executable file → Normal file
0
include/boost/iterator/is_readable_iterator.hpp
Executable file → Normal file
@ -7,9 +7,11 @@
|
||||
#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP
|
||||
#define BOOST_ITERATOR_FACADE_23022003THW_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/interoperable.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
||||
#include <boost/iterator/detail/enable_if.hpp>
|
||||
@ -56,6 +58,12 @@ namespace boost
|
||||
};
|
||||
};
|
||||
|
||||
// The type trait checks if the category or traversal is at least as advanced as the specified required traversal
|
||||
template< typename CategoryOrTraversal, typename Required >
|
||||
struct is_traversal_at_least :
|
||||
public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required >
|
||||
{};
|
||||
|
||||
//
|
||||
// enable if for use in operator implementation.
|
||||
//
|
||||
@ -64,11 +72,27 @@ namespace boost
|
||||
, class Facade2
|
||||
, class Return
|
||||
>
|
||||
struct enable_if_interoperable
|
||||
: ::boost::iterators::enable_if<
|
||||
mpl::or_<
|
||||
is_convertible<Facade1, Facade2>
|
||||
, is_convertible<Facade2, Facade1>
|
||||
struct enable_if_interoperable :
|
||||
public boost::iterators::enable_if<
|
||||
is_interoperable< Facade1, Facade2 >
|
||||
, Return
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// enable if for use in implementation of operators specific for random access traversal.
|
||||
//
|
||||
template <
|
||||
class Facade1
|
||||
, class Facade2
|
||||
, class Return
|
||||
>
|
||||
struct enable_if_interoperable_and_random_access_traversal :
|
||||
public boost::iterators::enable_if<
|
||||
mpl::and_<
|
||||
is_interoperable< Facade1, Facade2 >
|
||||
, is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag >
|
||||
, is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag >
|
||||
>
|
||||
, Return
|
||||
>
|
||||
@ -396,12 +420,24 @@ namespace boost
|
||||
{};
|
||||
|
||||
};
|
||||
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, bool IsBidirectionalTraversal
|
||||
, bool IsRandomAccessTraversal
|
||||
>
|
||||
class iterator_facade_base;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
// Macros which describe the declarations of binary operators
|
||||
# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
|
||||
template < \
|
||||
class Derived1, class V1, class TC1, class Reference1, class Difference1 \
|
||||
, class Derived2, class V2, class TC2, class Reference2, class Difference2 \
|
||||
@ -411,12 +447,12 @@ namespace boost
|
||||
iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
|
||||
, iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
|
||||
# else
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
|
||||
template < \
|
||||
class Derived1, class V1, class TC1, class Reference1, class Difference1 \
|
||||
, class Derived2, class V2, class TC2, class Reference2, class Difference2 \
|
||||
> \
|
||||
prefix typename boost::detail::enable_if_interoperable< \
|
||||
prefix typename enabler< \
|
||||
Derived1, Derived2 \
|
||||
, typename mpl::apply2<result_type,Derived1,Derived2>::type \
|
||||
>::type \
|
||||
@ -425,9 +461,18 @@ namespace boost
|
||||
, iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
|
||||
# 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)
|
||||
|
||||
# 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)
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \
|
||||
template <class Derived, class V, class TC, class R, class D> \
|
||||
prefix Derived operator+ args
|
||||
prefix typename boost::iterators::enable_if< \
|
||||
boost::detail::is_traversal_at_least< TC, boost::random_access_traversal_tag >, \
|
||||
Derived \
|
||||
>::type operator+ args
|
||||
|
||||
//
|
||||
// Helper class for granting access to the iterator core interface.
|
||||
@ -447,6 +492,8 @@ namespace boost
|
||||
# else
|
||||
|
||||
template <class I, class V, class TC, class R, class D> friend class iterator_facade;
|
||||
template <class I, class V, class TC, class R, class D, bool IsBidirectionalTraversal, bool IsRandomAccessTraversal>
|
||||
friend class detail::iterator_facade_base;
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RELATION(op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::detail::always_bool2);
|
||||
@ -454,13 +501,19 @@ namespace boost
|
||||
BOOST_ITERATOR_FACADE_RELATION(==)
|
||||
BOOST_ITERATOR_FACADE_RELATION(!=)
|
||||
|
||||
BOOST_ITERATOR_FACADE_RELATION(<)
|
||||
BOOST_ITERATOR_FACADE_RELATION(>)
|
||||
BOOST_ITERATOR_FACADE_RELATION(<=)
|
||||
BOOST_ITERATOR_FACADE_RELATION(>=)
|
||||
# undef BOOST_ITERATOR_FACADE_RELATION
|
||||
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(
|
||||
# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::detail::always_bool2);
|
||||
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
|
||||
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(
|
||||
friend, -, boost::detail::choose_difference_type)
|
||||
;
|
||||
|
||||
@ -545,23 +598,21 @@ namespace boost
|
||||
return *static_cast<I const*>(&facade);
|
||||
}
|
||||
|
||||
private:
|
||||
// objects of this class are useless
|
||||
iterator_core_access(); //undefined
|
||||
BOOST_DELETED_FUNCTION(iterator_core_access())
|
||||
};
|
||||
|
||||
//
|
||||
// iterator_facade - use as a public base class for defining new
|
||||
// standard-conforming iterators.
|
||||
//
|
||||
namespace detail {
|
||||
|
||||
// Implementation for forward traversal iterators
|
||||
template <
|
||||
class Derived // The derived iterator type being constructed
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference = Value&
|
||||
, class Difference = std::ptrdiff_t
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
class iterator_facade
|
||||
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
|
||||
# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||
: public boost::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
@ -570,6 +621,42 @@ namespace boost
|
||||
# endif
|
||||
{
|
||||
private:
|
||||
typedef boost::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
> associated_types;
|
||||
|
||||
typedef boost::detail::operator_arrow_dispatch<
|
||||
Reference
|
||||
, typename associated_types::pointer
|
||||
> operator_arrow_dispatch_;
|
||||
|
||||
public:
|
||||
typedef typename associated_types::value_type value_type;
|
||||
typedef Reference reference;
|
||||
typedef Difference difference_type;
|
||||
|
||||
typedef typename operator_arrow_dispatch_::result_type pointer;
|
||||
|
||||
typedef typename associated_types::iterator_category iterator_category;
|
||||
|
||||
public:
|
||||
reference operator*() const
|
||||
{
|
||||
return iterator_core_access::dereference(this->derived());
|
||||
}
|
||||
|
||||
pointer operator->() const
|
||||
{
|
||||
return operator_arrow_dispatch_::apply(*this->derived());
|
||||
}
|
||||
|
||||
Derived& operator++()
|
||||
{
|
||||
iterator_core_access::increment(this->derived());
|
||||
return this->derived();
|
||||
}
|
||||
|
||||
protected:
|
||||
//
|
||||
// Curiously Recurring Template interface.
|
||||
//
|
||||
@ -582,57 +669,20 @@ namespace boost
|
||||
{
|
||||
return *static_cast<Derived const*>(this);
|
||||
}
|
||||
};
|
||||
|
||||
typedef boost::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
> associated_types;
|
||||
|
||||
typedef boost::detail::operator_arrow_dispatch<
|
||||
Reference
|
||||
, typename associated_types::pointer
|
||||
> operator_arrow_dispatch_;
|
||||
|
||||
protected:
|
||||
// For use by derived classes
|
||||
typedef iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference> iterator_facade_;
|
||||
|
||||
// Implementation for bidirectional traversal iterators
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > :
|
||||
public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename associated_types::value_type value_type;
|
||||
typedef Reference reference;
|
||||
typedef Difference difference_type;
|
||||
|
||||
typedef typename operator_arrow_dispatch_::result_type pointer;
|
||||
|
||||
typedef typename associated_types::iterator_category iterator_category;
|
||||
|
||||
reference operator*() const
|
||||
{
|
||||
return iterator_core_access::dereference(this->derived());
|
||||
}
|
||||
|
||||
pointer operator->() const
|
||||
{
|
||||
return operator_arrow_dispatch_::apply(*this->derived());
|
||||
}
|
||||
|
||||
typename boost::detail::operator_brackets_result<Derived,Value,reference>::type
|
||||
operator[](difference_type n) const
|
||||
{
|
||||
typedef boost::detail::use_operator_brackets_proxy<Value,Reference> use_proxy;
|
||||
|
||||
return boost::detail::make_operator_brackets_result<Derived>(
|
||||
this->derived() + n
|
||||
, use_proxy()
|
||||
);
|
||||
}
|
||||
|
||||
Derived& operator++()
|
||||
{
|
||||
iterator_core_access::increment(this->derived());
|
||||
return this->derived();
|
||||
}
|
||||
|
||||
Derived& operator--()
|
||||
{
|
||||
iterator_core_access::decrement(this->derived());
|
||||
@ -645,6 +695,37 @@ namespace boost
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
// Implementation for random access traversal iterators
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true > :
|
||||
public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >
|
||||
{
|
||||
private:
|
||||
typedef iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::reference reference;
|
||||
typedef typename base_type::difference_type difference_type;
|
||||
|
||||
public:
|
||||
typename boost::detail::operator_brackets_result<Derived, Value, reference>::type
|
||||
operator[](difference_type n) const
|
||||
{
|
||||
typedef boost::detail::use_operator_brackets_proxy<Value, Reference> use_proxy;
|
||||
|
||||
return boost::detail::make_operator_brackets_result<Derived>(
|
||||
this->derived() + n
|
||||
, use_proxy()
|
||||
);
|
||||
}
|
||||
|
||||
Derived& operator+=(difference_type n)
|
||||
{
|
||||
@ -665,6 +746,35 @@ namespace boost
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// iterator_facade - use as a public base class for defining new
|
||||
// standard-conforming iterators.
|
||||
//
|
||||
template <
|
||||
class Derived // The derived iterator type being constructed
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference = Value&
|
||||
, class Difference = std::ptrdiff_t
|
||||
>
|
||||
class iterator_facade :
|
||||
public detail::iterator_facade_base<
|
||||
Derived,
|
||||
Value,
|
||||
CategoryOrTraversal,
|
||||
Reference,
|
||||
Difference,
|
||||
detail::is_traversal_at_least< CategoryOrTraversal, bidirectional_traversal_tag >::value,
|
||||
detail::is_traversal_at_least< CategoryOrTraversal, random_access_traversal_tag >::value
|
||||
>
|
||||
{
|
||||
protected:
|
||||
// For use by derived classes
|
||||
typedef iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference> iterator_facade_;
|
||||
};
|
||||
|
||||
template <class I, class V, class TC, class R, class D>
|
||||
inline typename boost::detail::postfix_increment_result<I,V,R,TC>::type
|
||||
operator++(
|
||||
@ -779,21 +889,50 @@ namespace boost
|
||||
BOOST_ITERATOR_FACADE_RELATION(==, return, equal)
|
||||
BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
|
||||
|
||||
BOOST_ITERATOR_FACADE_RELATION(<, return 0 >, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RELATION(>, return 0 <, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RELATION(<=, return 0 >=, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RELATION(>=, return 0 <=, distance_from)
|
||||
# undef BOOST_ITERATOR_FACADE_RELATION
|
||||
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \
|
||||
{ \
|
||||
/* 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 \
|
||||
)); \
|
||||
return_prefix iterator_core_access::base_op( \
|
||||
*static_cast<Derived1 const*>(&lhs) \
|
||||
, *static_cast<Derived2 const*>(&rhs) \
|
||||
, BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
|
||||
); \
|
||||
}
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
|
||||
op \
|
||||
, boost::detail::always_bool2 \
|
||||
, return_prefix \
|
||||
, base_op \
|
||||
)
|
||||
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=, return 0 >=, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=, return 0 <=, distance_from)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
|
||||
|
||||
// operator- requires an additional part in the static assertion
|
||||
BOOST_ITERATOR_FACADE_INTEROP(
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(
|
||||
-
|
||||
, boost::detail::choose_difference_type
|
||||
, return
|
||||
, distance_from
|
||||
)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_PLUS(args) \
|
||||
BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \
|
||||
@ -811,9 +950,14 @@ 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
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
0
include/boost/pointee.hpp
Executable file → Normal file
0
include/boost/pointee.hpp
Executable file → Normal file
0
index.html
Executable file → Normal file
0
index.html
Executable file → Normal file
0
test/constant_iter_arrow.cpp
Executable file → Normal file
0
test/constant_iter_arrow.cpp
Executable file → Normal file
0
test/constant_iter_arrow_fail.cpp
Executable file → Normal file
0
test/constant_iter_arrow_fail.cpp
Executable file → Normal file
0
test/interoperable.cpp
Executable file → Normal file
0
test/interoperable.cpp
Executable file → Normal file
0
test/iter_archetype_default_ctor.cpp
Executable file → Normal file
0
test/iter_archetype_default_ctor.cpp
Executable file → Normal file
Reference in New Issue
Block a user