mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
This commit is contained in:
parent
ff73538b5b
commit
23d53055f9
@ -6,13 +6,12 @@
|
||||
|
||||
# include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
# include <boost/static_assert.hpp>
|
||||
|
||||
# include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_const.hpp>
|
||||
@ -139,29 +138,21 @@ template <class Category, class Traversal>
|
||||
struct iterator_category_with_traversal
|
||||
: Category, Traversal
|
||||
{
|
||||
# if 0
|
||||
// Because of limitations on multiple user-defined conversions,
|
||||
// this should be a good test of whether convertibility is enough
|
||||
// in the spec, or whether we need to specify inheritance.
|
||||
operator Category() const { return Category(); }
|
||||
operator Traversal() const { return Traversal(); }
|
||||
# endif
|
||||
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
// Make sure this isn't used to build any categories where
|
||||
// convertibility to Traversal is redundant. Should just use the
|
||||
// Category element in that case.
|
||||
BOOST_STATIC_ASSERT(
|
||||
!(is_convertible<
|
||||
BOOST_MPL_ASSERT_NOT((
|
||||
is_convertible<
|
||||
typename iterator_category_to_traversal<Category>::type
|
||||
, Traversal
|
||||
>::value));
|
||||
>));
|
||||
|
||||
BOOST_STATIC_ASSERT(is_iterator_category<Category>::value);
|
||||
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
|
||||
BOOST_STATIC_ASSERT(!is_iterator_traversal<Category>::value);
|
||||
BOOST_MPL_ASSERT((is_iterator_category<Category>));
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>));
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
BOOST_STATIC_ASSERT(is_iterator_traversal<Traversal>::value);
|
||||
BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>));
|
||||
# endif
|
||||
# endif
|
||||
};
|
||||
@ -172,7 +163,7 @@ template <class Traversal, class ValueParam, class Reference>
|
||||
struct facade_iterator_category_impl
|
||||
{
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||
# endif
|
||||
|
||||
typedef typename iterator_facade_default_category<
|
||||
|
@ -110,7 +110,7 @@ namespace boost
|
||||
is_same<From,To>
|
||||
, is_convertible<From, To>
|
||||
>
|
||||
, detail::enable_type
|
||||
, boost::detail::enable_type
|
||||
, int&
|
||||
>::type type;
|
||||
};
|
||||
@ -120,7 +120,7 @@ namespace boost
|
||||
template <class From, class To>
|
||||
struct enable_if_convertible
|
||||
{
|
||||
typedef detail::enable_type type;
|
||||
typedef boost::detail::enable_type type;
|
||||
};
|
||||
|
||||
# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
|
||||
@ -134,7 +134,7 @@ namespace boost
|
||||
is_same<From,To>
|
||||
, is_convertible<From, To>
|
||||
>
|
||||
, detail::enable_type
|
||||
, boost::detail::enable_type
|
||||
>
|
||||
{};
|
||||
|
||||
@ -144,7 +144,7 @@ namespace boost
|
||||
struct enable_if_convertible
|
||||
: iterators::enable_if<
|
||||
is_convertible<From, To>
|
||||
, detail::enable_type
|
||||
, boost::detail::enable_type
|
||||
>
|
||||
{};
|
||||
|
||||
@ -183,7 +183,7 @@ namespace boost
|
||||
Derived
|
||||
|
||||
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
, typename detail::ia_dflt_help<
|
||||
, typename boost::detail::ia_dflt_help<
|
||||
Value
|
||||
, mpl::eval_if<
|
||||
is_same<Reference,use_default>
|
||||
@ -192,17 +192,17 @@ namespace boost
|
||||
>
|
||||
>::type
|
||||
# else
|
||||
, typename detail::ia_dflt_help<
|
||||
, typename boost::detail::ia_dflt_help<
|
||||
Value, iterator_value<Base>
|
||||
>::type
|
||||
# endif
|
||||
|
||||
, typename detail::ia_dflt_help<
|
||||
, typename boost::detail::ia_dflt_help<
|
||||
Traversal
|
||||
, iterator_traversal<Base>
|
||||
>::type
|
||||
|
||||
, typename detail::ia_dflt_help<
|
||||
, typename boost::detail::ia_dflt_help<
|
||||
Reference
|
||||
, mpl::eval_if<
|
||||
is_same<Value,use_default>
|
||||
@ -211,7 +211,7 @@ namespace boost
|
||||
>
|
||||
>::type
|
||||
|
||||
, typename detail::ia_dflt_help<
|
||||
, typename boost::detail::ia_dflt_help<
|
||||
Difference, iterator_difference<Base>
|
||||
>::type
|
||||
>
|
||||
@ -260,14 +260,14 @@ namespace boost
|
||||
, class Difference = use_default
|
||||
>
|
||||
class iterator_adaptor
|
||||
: public detail::iterator_adaptor_base<
|
||||
: public boost::detail::iterator_adaptor_base<
|
||||
Derived, Base, Value, Traversal, Reference, Difference
|
||||
>::type
|
||||
{
|
||||
friend class iterator_core_access;
|
||||
|
||||
protected:
|
||||
typedef typename detail::iterator_adaptor_base<
|
||||
typedef typename boost::detail::iterator_adaptor_base<
|
||||
Derived, Base, Value, Traversal, Reference, Difference
|
||||
>::type super_t;
|
||||
public:
|
||||
@ -323,7 +323,7 @@ namespace boost
|
||||
>::type my_traversal;
|
||||
|
||||
# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \
|
||||
detail::iterator_adaptor_assert_traversal<my_traversal, cat>();
|
||||
boost::detail::iterator_adaptor_assert_traversal<my_traversal, cat>();
|
||||
|
||||
void advance(typename super_t::difference_type n)
|
||||
{
|
||||
|
@ -196,6 +196,8 @@ namespace detail
|
||||
explicit archetype(ctor_arg arg)
|
||||
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
|
||||
{}
|
||||
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -219,7 +221,6 @@ namespace detail
|
||||
archetype()
|
||||
: traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg())
|
||||
{}
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -150,7 +150,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>
|
||||
, detail::old_category_to_traversal<Cat>
|
||||
, boost::detail::old_category_to_traversal<Cat>
|
||||
>
|
||||
{};
|
||||
|
||||
|
@ -6,12 +6,6 @@
|
||||
#ifndef BOOST_ITERATOR_CONCEPTS_HPP
|
||||
#define BOOST_ITERATOR_CONCEPTS_HPP
|
||||
|
||||
// Revision History
|
||||
// 26 Apr 2003 thw
|
||||
// Adapted to new iterator concepts
|
||||
// 22 Nov 2002 Thomas Witt
|
||||
// Added interoperable concept.
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
@ -20,7 +14,6 @@
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
@ -35,247 +28,226 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost_concepts {
|
||||
#include <boost/concept/detail/concept_def.hpp>
|
||||
|
||||
namespace boost_concepts
|
||||
{
|
||||
// Used a different namespace here (instead of "boost") so that the
|
||||
// concept descriptions do not take for granted the names in
|
||||
// namespace boost.
|
||||
|
||||
// We use this in place of STATIC_ASSERT((is_convertible<...>))
|
||||
// because some compilers (CWPro7.x) can't detect convertibility.
|
||||
//
|
||||
// Of course, that just gets us a different error at the moment with
|
||||
// some tests, since new iterator category deduction still depends
|
||||
// on convertibility detection. We might need some specializations
|
||||
// to support this compiler.
|
||||
template <class Target, class Source>
|
||||
struct static_assert_base_and_derived
|
||||
{
|
||||
static_assert_base_and_derived(Target* = (Source*)0) {}
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Access Concepts
|
||||
|
||||
template <typename Iterator>
|
||||
class ReadableIteratorConcept {
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||
BOOST_concept(ReadableIterator,(Iterator))
|
||||
: boost::Assignable<Iterator>
|
||||
, boost::CopyConstructible<Iterator>
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< boost::AssignableConcept<Iterator> >();
|
||||
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference reference;
|
||||
|
||||
value_type v = *i;
|
||||
boost::ignore_unused_variable_warning(v);
|
||||
}
|
||||
Iterator i;
|
||||
BOOST_CONCEPT_USAGE(ReadableIterator)
|
||||
{
|
||||
|
||||
value_type v = *i;
|
||||
boost::ignore_unused_variable_warning(v);
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <
|
||||
typename Iterator
|
||||
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
|
||||
>
|
||||
class WritableIteratorConcept {
|
||||
public:
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
||||
*i = v;
|
||||
}
|
||||
ValueType v;
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
class SwappableIteratorConcept {
|
||||
public:
|
||||
|
||||
void constraints() {
|
||||
std::iter_swap(i1, i2);
|
||||
}
|
||||
Iterator i1;
|
||||
Iterator i2;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
class LvalueIteratorConcept
|
||||
struct WritableIterator
|
||||
: boost::CopyConstructible<Iterator>
|
||||
{
|
||||
BOOST_CONCEPT_USAGE(WritableIterator)
|
||||
{
|
||||
*i = v;
|
||||
}
|
||||
private:
|
||||
ValueType v;
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <
|
||||
typename Iterator
|
||||
, 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)
|
||||
{
|
||||
std::iter_swap(i1, i2);
|
||||
}
|
||||
private:
|
||||
Iterator i1;
|
||||
Iterator i2;
|
||||
};
|
||||
|
||||
BOOST_concept(LvalueIterator,(Iterator))
|
||||
{
|
||||
public:
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||
void constraints()
|
||||
|
||||
BOOST_CONCEPT_USAGE(LvalueIterator)
|
||||
{
|
||||
value_type& r = const_cast<value_type&>(*i);
|
||||
boost::ignore_unused_variable_warning(r);
|
||||
}
|
||||
Iterator i;
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Traversal Concepts
|
||||
|
||||
template <typename Iterator>
|
||||
class IncrementableIteratorConcept {
|
||||
public:
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
BOOST_concept(IncrementableIterator,(Iterator))
|
||||
: boost::Assignable<Iterator>
|
||||
, boost::CopyConstructible<Iterator>
|
||||
{
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< boost::AssignableConcept<Iterator> >();
|
||||
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
traversal_category
|
||||
, boost::incrementable_traversal_tag
|
||||
>));
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<
|
||||
traversal_category
|
||||
, boost::incrementable_traversal_tag
|
||||
>::value
|
||||
));
|
||||
|
||||
++i;
|
||||
(void)i++;
|
||||
}
|
||||
Iterator i;
|
||||
BOOST_CONCEPT_USAGE(IncrementableIterator)
|
||||
{
|
||||
++i;
|
||||
(void)i++;
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
class SinglePassIteratorConcept {
|
||||
public:
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;
|
||||
BOOST_concept(SinglePassIterator,(Iterator))
|
||||
: IncrementableIterator<Iterator>
|
||||
, boost::EqualityComparable<Iterator>
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< IncrementableIteratorConcept<Iterator> >();
|
||||
boost::function_requires< boost::EqualityComparableConcept<Iterator> >();
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<
|
||||
traversal_category
|
||||
, boost::single_pass_traversal_tag
|
||||
>::value
|
||||
));
|
||||
}
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME SinglePassIterator::traversal_category
|
||||
, boost::single_pass_traversal_tag
|
||||
> ));
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
class ForwardTraversalConcept {
|
||||
public:
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;
|
||||
BOOST_concept(ForwardTraversal,(Iterator))
|
||||
: SinglePassIterator<Iterator>
|
||||
, 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);
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< SinglePassIteratorConcept<Iterator> >();
|
||||
boost::function_requires<
|
||||
boost::DefaultConstructibleConcept<Iterator> >();
|
||||
|
||||
typedef boost::mpl::and_<
|
||||
boost::is_integral<difference_type>,
|
||||
boost::mpl::bool_< std::numeric_limits<difference_type>::is_signed >
|
||||
> difference_type_is_signed_integral;
|
||||
|
||||
BOOST_STATIC_ASSERT(difference_type_is_signed_integral::value);
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<
|
||||
traversal_category
|
||||
, boost::forward_traversal_tag
|
||||
>::value
|
||||
));
|
||||
}
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME ForwardTraversal::traversal_category
|
||||
, boost::forward_traversal_tag
|
||||
> ));
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
class BidirectionalTraversalConcept {
|
||||
public:
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
BOOST_concept(BidirectionalTraversal,(Iterator))
|
||||
: ForwardTraversal<Iterator>
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME BidirectionalTraversal::traversal_category
|
||||
, boost::bidirectional_traversal_tag
|
||||
> ));
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< ForwardTraversalConcept<Iterator> >();
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<
|
||||
traversal_category
|
||||
, boost::bidirectional_traversal_tag
|
||||
>::value
|
||||
));
|
||||
|
||||
--i;
|
||||
(void)i--;
|
||||
}
|
||||
Iterator i;
|
||||
BOOST_CONCEPT_USAGE(BidirectionalTraversal)
|
||||
{
|
||||
--i;
|
||||
(void)i--;
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
class RandomAccessTraversalConcept {
|
||||
public:
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type
|
||||
difference_type;
|
||||
BOOST_concept(RandomAccessTraversal,(Iterator))
|
||||
: BidirectionalTraversal<Iterator>
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME RandomAccessTraversal::traversal_category
|
||||
, boost::random_access_traversal_tag
|
||||
> ));
|
||||
|
||||
void constraints() {
|
||||
boost::function_requires< BidirectionalTraversalConcept<Iterator> >();
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<
|
||||
traversal_category
|
||||
, boost::random_access_traversal_tag
|
||||
>::value
|
||||
));
|
||||
BOOST_CONCEPT_USAGE(RandomAccessTraversal)
|
||||
{
|
||||
i += n;
|
||||
i = i + n;
|
||||
i = n + i;
|
||||
i -= n;
|
||||
i = i - n;
|
||||
n = i - j;
|
||||
}
|
||||
|
||||
i += n;
|
||||
i = i + n;
|
||||
i = n + i;
|
||||
i -= n;
|
||||
i = i - n;
|
||||
n = i - j;
|
||||
}
|
||||
difference_type n;
|
||||
Iterator i, j;
|
||||
private:
|
||||
typename BidirectionalTraversal<Iterator>::difference_type n;
|
||||
Iterator i, j;
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Interoperability Concept
|
||||
// Iterator Interoperability
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Iterator1, typename Iterator2>
|
||||
void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2)
|
||||
{
|
||||
bool b;
|
||||
b = i1 == i2;
|
||||
b = i1 != i2;
|
||||
|
||||
b = i2 == i1;
|
||||
b = i2 != i1;
|
||||
bool b;
|
||||
b = i1 == i2;
|
||||
b = i1 != i2;
|
||||
|
||||
b = i2 == i1;
|
||||
b = i2 != i1;
|
||||
boost::ignore_unused_variable_warning(b);
|
||||
}
|
||||
|
||||
|
||||
template <typename Iterator1, typename Iterator2>
|
||||
void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2,
|
||||
boost::random_access_traversal_tag, boost::random_access_traversal_tag)
|
||||
void interop_rand_access_constraints(
|
||||
Iterator1 const& i1, Iterator2 const& i2,
|
||||
boost::random_access_traversal_tag, boost::random_access_traversal_tag)
|
||||
{
|
||||
bool b;
|
||||
typename boost::detail::iterator_traits<Iterator2>::difference_type n;
|
||||
b = i1 < i2;
|
||||
b = i1 <= i2;
|
||||
b = i1 > i2;
|
||||
b = i1 >= i2;
|
||||
n = i1 - i2;
|
||||
|
||||
b = i2 < i1;
|
||||
b = i2 <= i1;
|
||||
b = i2 > i1;
|
||||
b = i2 >= i1;
|
||||
n = i2 - i1;
|
||||
bool b;
|
||||
typename boost::detail::iterator_traits<Iterator2>::difference_type n;
|
||||
b = i1 < i2;
|
||||
b = i1 <= i2;
|
||||
b = i1 > i2;
|
||||
b = i1 >= i2;
|
||||
n = i1 - i2;
|
||||
|
||||
b = i2 < i1;
|
||||
b = i2 <= i1;
|
||||
b = i2 > i1;
|
||||
b = i2 >= i1;
|
||||
n = i2 - i1;
|
||||
boost::ignore_unused_variable_warning(b);
|
||||
boost::ignore_unused_variable_warning(n);
|
||||
}
|
||||
|
||||
template <typename Iterator1, typename Iterator2>
|
||||
void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2,
|
||||
boost::single_pass_traversal_tag, boost::single_pass_traversal_tag)
|
||||
void interop_rand_access_constraints(
|
||||
Iterator1 const&, Iterator2 const&,
|
||||
boost::single_pass_traversal_tag, boost::single_pass_traversal_tag)
|
||||
{ }
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename Iterator, typename ConstIterator>
|
||||
class InteroperableIteratorConcept
|
||||
BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator))
|
||||
{
|
||||
public:
|
||||
private:
|
||||
typedef typename boost::detail::pure_traversal_tag<
|
||||
typename boost::iterator_traversal<
|
||||
Iterator
|
||||
@ -287,22 +259,26 @@ namespace boost_concepts {
|
||||
ConstIterator
|
||||
>::type
|
||||
>::type const_traversal_category;
|
||||
|
||||
public:
|
||||
BOOST_CONCEPT_ASSERT((SinglePassIterator<Iterator>));
|
||||
BOOST_CONCEPT_ASSERT((SinglePassIterator<ConstIterator>));
|
||||
|
||||
void constraints()
|
||||
BOOST_CONCEPT_USAGE(InteroperableIterator)
|
||||
{
|
||||
boost::function_requires< SinglePassIteratorConcept<Iterator> >();
|
||||
boost::function_requires< SinglePassIteratorConcept<ConstIterator> >();
|
||||
|
||||
detail::interop_single_pass_constraints(i, ci);
|
||||
detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category());
|
||||
|
||||
ci = i;
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator i;
|
||||
ConstIterator ci;
|
||||
};
|
||||
|
||||
} // namespace boost_concepts
|
||||
|
||||
#include <boost/concept/detail/concept_undef.hpp>
|
||||
|
||||
#endif // BOOST_ITERATOR_CONCEPTS_HPP
|
||||
|
@ -106,7 +106,7 @@ namespace boost
|
||||
typedef typename remove_const<ValueParam>::type value_type;
|
||||
|
||||
typedef typename mpl::eval_if<
|
||||
detail::iterator_writability_disabled<ValueParam,Reference>
|
||||
boost::detail::iterator_writability_disabled<ValueParam,Reference>
|
||||
, add_pointer<const value_type>
|
||||
, add_pointer<value_type>
|
||||
>::type pointer;
|
||||
@ -446,7 +446,7 @@ namespace boost
|
||||
class Derived1, class V1, class TC1, class R1, class D1 \
|
||||
, class Derived2, class V2, class TC2, class R2, class D2 \
|
||||
> \
|
||||
prefix typename detail::enable_if_interoperable< \
|
||||
prefix typename boost::detail::enable_if_interoperable< \
|
||||
Derived1, Derived2 \
|
||||
, typename mpl::apply2<result_type,Derived1,Derived2>::type \
|
||||
>::type \
|
||||
@ -480,7 +480,7 @@ namespace boost
|
||||
template <class I, class V, class TC, class R, class D> friend class iterator_facade;
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RELATION(op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, detail::always_bool2);
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::detail::always_bool2);
|
||||
|
||||
BOOST_ITERATOR_FACADE_RELATION(==)
|
||||
BOOST_ITERATOR_FACADE_RELATION(!=)
|
||||
@ -492,7 +492,7 @@ namespace boost
|
||||
# undef BOOST_ITERATOR_FACADE_RELATION
|
||||
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(
|
||||
friend, -, detail::choose_difference_type)
|
||||
friend, -, boost::detail::choose_difference_type)
|
||||
;
|
||||
|
||||
BOOST_ITERATOR_FACADE_PLUS_HEAD(
|
||||
@ -594,7 +594,7 @@ namespace boost
|
||||
>
|
||||
class iterator_facade
|
||||
# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||
: public detail::iterator_facade_types<
|
||||
: public boost::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
>::base
|
||||
# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||
@ -614,7 +614,7 @@ namespace boost
|
||||
return *static_cast<Derived const*>(this);
|
||||
}
|
||||
|
||||
typedef detail::iterator_facade_types<
|
||||
typedef boost::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
> associated_types;
|
||||
|
||||
@ -635,26 +635,26 @@ namespace boost
|
||||
return iterator_core_access::dereference(this->derived());
|
||||
}
|
||||
|
||||
typename detail::operator_arrow_result<
|
||||
typename boost::detail::operator_arrow_result<
|
||||
value_type
|
||||
, reference
|
||||
, pointer
|
||||
>::type
|
||||
operator->() const
|
||||
{
|
||||
return detail::operator_arrow_result<
|
||||
return boost::detail::operator_arrow_result<
|
||||
value_type
|
||||
, reference
|
||||
, pointer
|
||||
>::make(*this->derived());
|
||||
}
|
||||
|
||||
typename detail::operator_brackets_result<Derived,Value,reference>::type
|
||||
typename boost::detail::operator_brackets_result<Derived,Value,reference>::type
|
||||
operator[](difference_type n) const
|
||||
{
|
||||
typedef detail::use_operator_brackets_proxy<Value,Reference> use_proxy;
|
||||
typedef boost::detail::use_operator_brackets_proxy<Value,Reference> use_proxy;
|
||||
|
||||
return detail::make_operator_brackets_result<Derived>(
|
||||
return boost::detail::make_operator_brackets_result<Derived>(
|
||||
this->derived() + n
|
||||
, use_proxy()
|
||||
);
|
||||
@ -667,10 +667,10 @@ namespace boost
|
||||
}
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
typename detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type
|
||||
typename boost::detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type
|
||||
operator++(int)
|
||||
{
|
||||
typename detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type
|
||||
typename boost::detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type
|
||||
tmp(this->derived());
|
||||
++*this;
|
||||
return tmp;
|
||||
@ -723,13 +723,13 @@ namespace boost
|
||||
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class I, class V, class TC, class R, class D>
|
||||
inline typename detail::postfix_increment_result<I,V,R,TC>::type
|
||||
inline typename boost::detail::postfix_increment_result<I,V,R,TC>::type
|
||||
operator++(
|
||||
iterator_facade<I,V,TC,R,D>& i
|
||||
, int
|
||||
)
|
||||
{
|
||||
typename detail::postfix_increment_result<I,V,R,TC>::type
|
||||
typename boost::detail::postfix_increment_result<I,V,R,TC>::type
|
||||
tmp(*static_cast<I*>(&i));
|
||||
|
||||
++i;
|
||||
@ -829,7 +829,7 @@ namespace boost
|
||||
# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP( \
|
||||
op \
|
||||
, detail::always_bool2 \
|
||||
, boost::detail::always_bool2 \
|
||||
, return_prefix \
|
||||
, base_op \
|
||||
)
|
||||
@ -846,7 +846,7 @@ namespace boost
|
||||
// operator- requires an additional part in the static assertion
|
||||
BOOST_ITERATOR_FACADE_INTEROP(
|
||||
-
|
||||
, detail::choose_difference_type
|
||||
, boost::detail::choose_difference_type
|
||||
, return
|
||||
, distance_from
|
||||
)
|
||||
|
@ -27,32 +27,32 @@ namespace boost {
|
||||
template <class Iterator>
|
||||
struct iterator_value
|
||||
{
|
||||
typedef typename detail::iterator_traits<Iterator>::value_type type;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type type;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_reference
|
||||
{
|
||||
typedef typename detail::iterator_traits<Iterator>::reference type;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
|
||||
};
|
||||
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_pointer
|
||||
{
|
||||
typedef typename detail::iterator_traits<Iterator>::pointer type;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::pointer type;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_difference
|
||||
{
|
||||
typedef typename detail::iterator_traits<Iterator>::difference_type type;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type type;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct BOOST_ITERATOR_CATEGORY
|
||||
{
|
||||
typedef typename detail::iterator_traits<Iterator>::iterator_category type;
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type;
|
||||
};
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
@ -37,10 +37,10 @@ namespace boost
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <class UnaryFunction>
|
||||
template <class UnaryFunc>
|
||||
struct function_object_result
|
||||
{
|
||||
typedef typename UnaryFunction::result_type type;
|
||||
typedef typename UnaryFunc::result_type type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
@ -52,7 +52,7 @@ namespace boost
|
||||
#endif
|
||||
|
||||
// Compute the iterator_adaptor instantiation to be used for transform_iterator
|
||||
template <class UnaryFunction, class Iterator, class Reference, class Value>
|
||||
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
||||
struct transform_iterator_base
|
||||
{
|
||||
private:
|
||||
@ -62,7 +62,7 @@ namespace boost
|
||||
// proposal (e.g. using Doug's result_of)?
|
||||
typedef typename ia_dflt_help<
|
||||
Reference
|
||||
, function_object_result<UnaryFunction>
|
||||
, function_object_result<UnaryFunc>
|
||||
>::type reference;
|
||||
|
||||
// To get the default for Value: remove any reference on the
|
||||
@ -77,7 +77,7 @@ namespace boost
|
||||
|
||||
public:
|
||||
typedef iterator_adaptor<
|
||||
transform_iterator<UnaryFunction, Iterator, Reference, Value>
|
||||
transform_iterator<UnaryFunc, Iterator, Reference, Value>
|
||||
, Iterator
|
||||
, cv_value_type
|
||||
, use_default // Leave the traversal category alone
|
||||
@ -86,12 +86,12 @@ namespace boost
|
||||
};
|
||||
}
|
||||
|
||||
template <class UnaryFunction, class Iterator, class Reference, class Value>
|
||||
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
||||
class transform_iterator
|
||||
: public detail::transform_iterator_base<UnaryFunction, Iterator, Reference, Value>::type
|
||||
: public boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
||||
{
|
||||
typedef typename
|
||||
detail::transform_iterator_base<UnaryFunction, Iterator, Reference, Value>::type
|
||||
boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
||||
super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
@ -99,7 +99,7 @@ namespace boost
|
||||
public:
|
||||
transform_iterator() { }
|
||||
|
||||
transform_iterator(Iterator const& x, UnaryFunction f)
|
||||
transform_iterator(Iterator const& x, UnaryFunc f)
|
||||
: super_t(x), m_f(f) { }
|
||||
|
||||
explicit transform_iterator(Iterator const& x)
|
||||
@ -108,9 +108,9 @@ namespace boost
|
||||
// Pro8 is a little too aggressive about instantiating the
|
||||
// body of this function.
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
// don't provide this constructor if UnaryFunction is a
|
||||
// don't provide this constructor if UnaryFunc is a
|
||||
// function pointer type, since it will be 0. Too dangerous.
|
||||
BOOST_STATIC_ASSERT(is_class<UnaryFunction>::value);
|
||||
BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -123,13 +123,13 @@ namespace boost
|
||||
transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunction>::type* = 0
|
||||
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0
|
||||
#endif
|
||||
)
|
||||
: super_t(t.base()), m_f(t.functor())
|
||||
{}
|
||||
|
||||
UnaryFunction functor() const
|
||||
UnaryFunc functor() const
|
||||
{ return m_f; }
|
||||
|
||||
private:
|
||||
@ -138,38 +138,38 @@ namespace boost
|
||||
|
||||
// Probably should be the initial base class so it can be
|
||||
// optimized away via EBO if it is an empty class.
|
||||
UnaryFunction m_f;
|
||||
UnaryFunc m_f;
|
||||
};
|
||||
|
||||
template <class UnaryFunction, class Iterator>
|
||||
transform_iterator<UnaryFunction, Iterator>
|
||||
make_transform_iterator(Iterator it, UnaryFunction fun)
|
||||
template <class UnaryFunc, class Iterator>
|
||||
transform_iterator<UnaryFunc, Iterator>
|
||||
make_transform_iterator(Iterator it, UnaryFunc fun)
|
||||
{
|
||||
return transform_iterator<UnaryFunction, Iterator>(it, fun);
|
||||
return transform_iterator<UnaryFunc, Iterator>(it, fun);
|
||||
}
|
||||
|
||||
// Version which allows explicit specification of the UnaryFunction
|
||||
// Version which allows explicit specification of the UnaryFunc
|
||||
// type.
|
||||
//
|
||||
// This generator is not provided if UnaryFunction is a function
|
||||
// This generator is not provided if UnaryFunc is a function
|
||||
// pointer type, because it's too dangerous: the default-constructed
|
||||
// function pointer in the iterator be 0, leading to a runtime
|
||||
// crash.
|
||||
template <class UnaryFunction, class Iterator>
|
||||
template <class UnaryFunc, class Iterator>
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
typename mpl::if_<
|
||||
#else
|
||||
typename iterators::enable_if<
|
||||
#endif
|
||||
is_class<UnaryFunction> // We should probably find a cheaper test than is_class<>
|
||||
, transform_iterator<UnaryFunction, Iterator>
|
||||
is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
|
||||
, transform_iterator<UnaryFunc, Iterator>
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
, int[3]
|
||||
#endif
|
||||
>::type
|
||||
make_transform_iterator(Iterator it)
|
||||
{
|
||||
return transform_iterator<UnaryFunction, Iterator>(it, UnaryFunction());
|
||||
return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc());
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Copyright David Abrahams 2004. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See www.boost.org/libs/iterator for documentation.
|
||||
|
||||
#ifndef ITERATOR_ADAPTORS_DWA2004725_HPP
|
||||
# define ITERATOR_ADAPTORS_DWA2004725_HPP
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user