mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-11 05:23:52 +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/iterator/iterator_categories.hpp>
|
||||||
|
|
||||||
# include <boost/static_assert.hpp>
|
|
||||||
|
|
||||||
# include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic
|
# include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic
|
||||||
# include <boost/mpl/and.hpp>
|
# include <boost/mpl/and.hpp>
|
||||||
# include <boost/mpl/if.hpp>
|
# include <boost/mpl/if.hpp>
|
||||||
# include <boost/mpl/eval_if.hpp>
|
# include <boost/mpl/eval_if.hpp>
|
||||||
# include <boost/mpl/identity.hpp>
|
# include <boost/mpl/identity.hpp>
|
||||||
|
# include <boost/mpl/assert.hpp>
|
||||||
|
|
||||||
# include <boost/type_traits/is_same.hpp>
|
# include <boost/type_traits/is_same.hpp>
|
||||||
# include <boost/type_traits/is_const.hpp>
|
# include <boost/type_traits/is_const.hpp>
|
||||||
@ -139,29 +138,21 @@ template <class Category, class Traversal>
|
|||||||
struct iterator_category_with_traversal
|
struct iterator_category_with_traversal
|
||||||
: Category, 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)
|
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
// Make sure this isn't used to build any categories where
|
// Make sure this isn't used to build any categories where
|
||||||
// convertibility to Traversal is redundant. Should just use the
|
// convertibility to Traversal is redundant. Should just use the
|
||||||
// Category element in that case.
|
// Category element in that case.
|
||||||
BOOST_STATIC_ASSERT(
|
BOOST_MPL_ASSERT_NOT((
|
||||||
!(is_convertible<
|
is_convertible<
|
||||||
typename iterator_category_to_traversal<Category>::type
|
typename iterator_category_to_traversal<Category>::type
|
||||||
, Traversal
|
, Traversal
|
||||||
>::value));
|
>));
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(is_iterator_category<Category>::value);
|
BOOST_MPL_ASSERT((is_iterator_category<Category>));
|
||||||
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
|
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||||
BOOST_STATIC_ASSERT(!is_iterator_traversal<Category>::value);
|
BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>));
|
||||||
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
# 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
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
@ -172,7 +163,7 @@ template <class Traversal, class ValueParam, class Reference>
|
|||||||
struct facade_iterator_category_impl
|
struct facade_iterator_category_impl
|
||||||
{
|
{
|
||||||
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
|
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
typedef typename iterator_facade_default_category<
|
typedef typename iterator_facade_default_category<
|
||||||
|
@ -110,7 +110,7 @@ namespace boost
|
|||||||
is_same<From,To>
|
is_same<From,To>
|
||||||
, is_convertible<From, To>
|
, is_convertible<From, To>
|
||||||
>
|
>
|
||||||
, detail::enable_type
|
, boost::detail::enable_type
|
||||||
, int&
|
, int&
|
||||||
>::type type;
|
>::type type;
|
||||||
};
|
};
|
||||||
@ -120,7 +120,7 @@ namespace boost
|
|||||||
template <class From, class To>
|
template <class From, class To>
|
||||||
struct enable_if_convertible
|
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
|
# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
|
||||||
@ -134,7 +134,7 @@ namespace boost
|
|||||||
is_same<From,To>
|
is_same<From,To>
|
||||||
, is_convertible<From, To>
|
, is_convertible<From, To>
|
||||||
>
|
>
|
||||||
, detail::enable_type
|
, boost::detail::enable_type
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ namespace boost
|
|||||||
struct enable_if_convertible
|
struct enable_if_convertible
|
||||||
: iterators::enable_if<
|
: iterators::enable_if<
|
||||||
is_convertible<From, To>
|
is_convertible<From, To>
|
||||||
, detail::enable_type
|
, boost::detail::enable_type
|
||||||
>
|
>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ namespace boost
|
|||||||
Derived
|
Derived
|
||||||
|
|
||||||
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||||
, typename detail::ia_dflt_help<
|
, typename boost::detail::ia_dflt_help<
|
||||||
Value
|
Value
|
||||||
, mpl::eval_if<
|
, mpl::eval_if<
|
||||||
is_same<Reference,use_default>
|
is_same<Reference,use_default>
|
||||||
@ -192,17 +192,17 @@ namespace boost
|
|||||||
>
|
>
|
||||||
>::type
|
>::type
|
||||||
# else
|
# else
|
||||||
, typename detail::ia_dflt_help<
|
, typename boost::detail::ia_dflt_help<
|
||||||
Value, iterator_value<Base>
|
Value, iterator_value<Base>
|
||||||
>::type
|
>::type
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
, typename detail::ia_dflt_help<
|
, typename boost::detail::ia_dflt_help<
|
||||||
Traversal
|
Traversal
|
||||||
, iterator_traversal<Base>
|
, iterator_traversal<Base>
|
||||||
>::type
|
>::type
|
||||||
|
|
||||||
, typename detail::ia_dflt_help<
|
, typename boost::detail::ia_dflt_help<
|
||||||
Reference
|
Reference
|
||||||
, mpl::eval_if<
|
, mpl::eval_if<
|
||||||
is_same<Value,use_default>
|
is_same<Value,use_default>
|
||||||
@ -211,7 +211,7 @@ namespace boost
|
|||||||
>
|
>
|
||||||
>::type
|
>::type
|
||||||
|
|
||||||
, typename detail::ia_dflt_help<
|
, typename boost::detail::ia_dflt_help<
|
||||||
Difference, iterator_difference<Base>
|
Difference, iterator_difference<Base>
|
||||||
>::type
|
>::type
|
||||||
>
|
>
|
||||||
@ -260,14 +260,14 @@ namespace boost
|
|||||||
, class Difference = use_default
|
, class Difference = use_default
|
||||||
>
|
>
|
||||||
class iterator_adaptor
|
class iterator_adaptor
|
||||||
: public detail::iterator_adaptor_base<
|
: public boost::detail::iterator_adaptor_base<
|
||||||
Derived, Base, Value, Traversal, Reference, Difference
|
Derived, Base, Value, Traversal, Reference, Difference
|
||||||
>::type
|
>::type
|
||||||
{
|
{
|
||||||
friend class iterator_core_access;
|
friend class iterator_core_access;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef typename detail::iterator_adaptor_base<
|
typedef typename boost::detail::iterator_adaptor_base<
|
||||||
Derived, Base, Value, Traversal, Reference, Difference
|
Derived, Base, Value, Traversal, Reference, Difference
|
||||||
>::type super_t;
|
>::type super_t;
|
||||||
public:
|
public:
|
||||||
@ -323,7 +323,7 @@ namespace boost
|
|||||||
>::type my_traversal;
|
>::type my_traversal;
|
||||||
|
|
||||||
# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \
|
# 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)
|
void advance(typename super_t::difference_type n)
|
||||||
{
|
{
|
||||||
|
@ -196,6 +196,8 @@ namespace detail
|
|||||||
explicit archetype(ctor_arg arg)
|
explicit archetype(ctor_arg arg)
|
||||||
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
|
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -219,7 +221,6 @@ namespace detail
|
|||||||
archetype()
|
archetype()
|
||||||
: traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg())
|
: 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.
|
: mpl::eval_if< // if already convertible to a traversal tag, we're done.
|
||||||
is_convertible<Cat,incrementable_traversal_tag>
|
is_convertible<Cat,incrementable_traversal_tag>
|
||||||
, mpl::identity<Cat>
|
, 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
|
#ifndef BOOST_ITERATOR_CONCEPTS_HPP
|
||||||
#define 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/concept_check.hpp>
|
||||||
#include <boost/iterator/iterator_categories.hpp>
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
|
|
||||||
@ -20,7 +14,6 @@
|
|||||||
|
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
#include <boost/type_traits/is_integral.hpp>
|
#include <boost/type_traits/is_integral.hpp>
|
||||||
#include <boost/type_traits/is_convertible.hpp>
|
|
||||||
|
|
||||||
#include <boost/mpl/bool.hpp>
|
#include <boost/mpl/bool.hpp>
|
||||||
#include <boost/mpl/if.hpp>
|
#include <boost/mpl/if.hpp>
|
||||||
@ -35,247 +28,226 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#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
|
// Used a different namespace here (instead of "boost") so that the
|
||||||
// concept descriptions do not take for granted the names in
|
// concept descriptions do not take for granted the names in
|
||||||
// namespace boost.
|
// 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
|
// Iterator Access Concepts
|
||||||
|
|
||||||
template <typename Iterator>
|
BOOST_concept(ReadableIterator,(Iterator))
|
||||||
class ReadableIteratorConcept {
|
: boost::Assignable<Iterator>
|
||||||
public:
|
, boost::CopyConstructible<Iterator>
|
||||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
|
||||||
|
|
||||||
void constraints() {
|
{
|
||||||
boost::function_requires< boost::AssignableConcept<Iterator> >();
|
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||||
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference reference;
|
||||||
|
|
||||||
value_type v = *i;
|
BOOST_CONCEPT_USAGE(ReadableIterator)
|
||||||
boost::ignore_unused_variable_warning(v);
|
{
|
||||||
}
|
|
||||||
Iterator i;
|
value_type v = *i;
|
||||||
|
boost::ignore_unused_variable_warning(v);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Iterator i;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <
|
template <
|
||||||
typename Iterator
|
typename Iterator
|
||||||
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
|
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
|
||||||
>
|
>
|
||||||
class WritableIteratorConcept {
|
struct WritableIterator
|
||||||
public:
|
: boost::CopyConstructible<Iterator>
|
||||||
|
{
|
||||||
void constraints() {
|
BOOST_CONCEPT_USAGE(WritableIterator)
|
||||||
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
{
|
||||||
*i = v;
|
*i = v;
|
||||||
}
|
}
|
||||||
ValueType v;
|
private:
|
||||||
Iterator i;
|
ValueType v;
|
||||||
};
|
Iterator i;
|
||||||
|
};
|
||||||
template <typename Iterator>
|
|
||||||
class SwappableIteratorConcept {
|
template <
|
||||||
public:
|
typename Iterator
|
||||||
|
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
|
||||||
void constraints() {
|
>
|
||||||
std::iter_swap(i1, i2);
|
struct WritableIteratorConcept : WritableIterator<Iterator,ValueType> {};
|
||||||
}
|
|
||||||
Iterator i1;
|
BOOST_concept(SwappableIterator,(Iterator))
|
||||||
Iterator i2;
|
{
|
||||||
};
|
BOOST_CONCEPT_USAGE(SwappableIterator)
|
||||||
|
{
|
||||||
template <typename Iterator>
|
std::iter_swap(i1, i2);
|
||||||
class LvalueIteratorConcept
|
}
|
||||||
|
private:
|
||||||
|
Iterator i1;
|
||||||
|
Iterator i2;
|
||||||
|
};
|
||||||
|
|
||||||
|
BOOST_concept(LvalueIterator,(Iterator))
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
|
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);
|
value_type& r = const_cast<value_type&>(*i);
|
||||||
boost::ignore_unused_variable_warning(r);
|
boost::ignore_unused_variable_warning(r);
|
||||||
}
|
}
|
||||||
Iterator i;
|
private:
|
||||||
|
Iterator i;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Iterator Traversal Concepts
|
// Iterator Traversal Concepts
|
||||||
|
|
||||||
template <typename Iterator>
|
BOOST_concept(IncrementableIterator,(Iterator))
|
||||||
class IncrementableIteratorConcept {
|
: boost::Assignable<Iterator>
|
||||||
public:
|
, boost::CopyConstructible<Iterator>
|
||||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
{
|
||||||
|
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||||
|
|
||||||
void constraints() {
|
BOOST_CONCEPT_ASSERT((
|
||||||
boost::function_requires< boost::AssignableConcept<Iterator> >();
|
boost::Convertible<
|
||||||
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
traversal_category
|
||||||
|
, boost::incrementable_traversal_tag
|
||||||
|
>));
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(
|
BOOST_CONCEPT_USAGE(IncrementableIterator)
|
||||||
(boost::is_convertible<
|
{
|
||||||
traversal_category
|
++i;
|
||||||
, boost::incrementable_traversal_tag
|
(void)i++;
|
||||||
>::value
|
}
|
||||||
));
|
private:
|
||||||
|
Iterator i;
|
||||||
++i;
|
|
||||||
(void)i++;
|
|
||||||
}
|
|
||||||
Iterator i;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Iterator>
|
BOOST_concept(SinglePassIterator,(Iterator))
|
||||||
class SinglePassIteratorConcept {
|
: IncrementableIterator<Iterator>
|
||||||
public:
|
, boost::EqualityComparable<Iterator>
|
||||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
|
||||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;
|
|
||||||
|
|
||||||
void constraints() {
|
{
|
||||||
boost::function_requires< IncrementableIteratorConcept<Iterator> >();
|
BOOST_CONCEPT_ASSERT((
|
||||||
boost::function_requires< boost::EqualityComparableConcept<Iterator> >();
|
boost::Convertible<
|
||||||
|
BOOST_DEDUCED_TYPENAME SinglePassIterator::traversal_category
|
||||||
BOOST_STATIC_ASSERT(
|
, boost::single_pass_traversal_tag
|
||||||
(boost::is_convertible<
|
> ));
|
||||||
traversal_category
|
|
||||||
, boost::single_pass_traversal_tag
|
|
||||||
>::value
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Iterator>
|
BOOST_concept(ForwardTraversal,(Iterator))
|
||||||
class ForwardTraversalConcept {
|
: SinglePassIterator<Iterator>
|
||||||
public:
|
, boost::DefaultConstructible<Iterator>
|
||||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
{
|
||||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;
|
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_CONCEPT_ASSERT((
|
||||||
boost::function_requires< SinglePassIteratorConcept<Iterator> >();
|
boost::Convertible<
|
||||||
boost::function_requires<
|
BOOST_DEDUCED_TYPENAME ForwardTraversal::traversal_category
|
||||||
boost::DefaultConstructibleConcept<Iterator> >();
|
, boost::forward_traversal_tag
|
||||||
|
> ));
|
||||||
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
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Iterator>
|
BOOST_concept(BidirectionalTraversal,(Iterator))
|
||||||
class BidirectionalTraversalConcept {
|
: ForwardTraversal<Iterator>
|
||||||
public:
|
{
|
||||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
BOOST_CONCEPT_ASSERT((
|
||||||
|
boost::Convertible<
|
||||||
|
BOOST_DEDUCED_TYPENAME BidirectionalTraversal::traversal_category
|
||||||
|
, boost::bidirectional_traversal_tag
|
||||||
|
> ));
|
||||||
|
|
||||||
void constraints() {
|
BOOST_CONCEPT_USAGE(BidirectionalTraversal)
|
||||||
boost::function_requires< ForwardTraversalConcept<Iterator> >();
|
{
|
||||||
|
--i;
|
||||||
BOOST_STATIC_ASSERT(
|
(void)i--;
|
||||||
(boost::is_convertible<
|
}
|
||||||
traversal_category
|
private:
|
||||||
, boost::bidirectional_traversal_tag
|
Iterator i;
|
||||||
>::value
|
|
||||||
));
|
|
||||||
|
|
||||||
--i;
|
|
||||||
(void)i--;
|
|
||||||
}
|
|
||||||
Iterator i;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Iterator>
|
BOOST_concept(RandomAccessTraversal,(Iterator))
|
||||||
class RandomAccessTraversalConcept {
|
: BidirectionalTraversal<Iterator>
|
||||||
public:
|
{
|
||||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
BOOST_CONCEPT_ASSERT((
|
||||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type
|
boost::Convertible<
|
||||||
difference_type;
|
BOOST_DEDUCED_TYPENAME RandomAccessTraversal::traversal_category
|
||||||
|
, boost::random_access_traversal_tag
|
||||||
|
> ));
|
||||||
|
|
||||||
void constraints() {
|
BOOST_CONCEPT_USAGE(RandomAccessTraversal)
|
||||||
boost::function_requires< BidirectionalTraversalConcept<Iterator> >();
|
{
|
||||||
|
i += n;
|
||||||
BOOST_STATIC_ASSERT(
|
i = i + n;
|
||||||
(boost::is_convertible<
|
i = n + i;
|
||||||
traversal_category
|
i -= n;
|
||||||
, boost::random_access_traversal_tag
|
i = i - n;
|
||||||
>::value
|
n = i - j;
|
||||||
));
|
}
|
||||||
|
|
||||||
i += n;
|
private:
|
||||||
i = i + n;
|
typename BidirectionalTraversal<Iterator>::difference_type n;
|
||||||
i = n + i;
|
Iterator i, j;
|
||||||
i -= n;
|
|
||||||
i = i - n;
|
|
||||||
n = i - j;
|
|
||||||
}
|
|
||||||
difference_type n;
|
|
||||||
Iterator i, j;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Iterator Interoperability Concept
|
// Iterator Interoperability
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename Iterator1, typename Iterator2>
|
template <typename Iterator1, typename Iterator2>
|
||||||
void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2)
|
void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2)
|
||||||
{
|
{
|
||||||
bool b;
|
bool b;
|
||||||
b = i1 == i2;
|
b = i1 == i2;
|
||||||
b = i1 != i2;
|
b = i1 != i2;
|
||||||
|
|
||||||
b = i2 == i1;
|
b = i2 == i1;
|
||||||
b = i2 != i1;
|
b = i2 != i1;
|
||||||
|
boost::ignore_unused_variable_warning(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator1, typename Iterator2>
|
template <typename Iterator1, typename Iterator2>
|
||||||
void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2,
|
void interop_rand_access_constraints(
|
||||||
boost::random_access_traversal_tag, boost::random_access_traversal_tag)
|
Iterator1 const& i1, Iterator2 const& i2,
|
||||||
|
boost::random_access_traversal_tag, boost::random_access_traversal_tag)
|
||||||
{
|
{
|
||||||
bool b;
|
bool b;
|
||||||
typename boost::detail::iterator_traits<Iterator2>::difference_type n;
|
typename boost::detail::iterator_traits<Iterator2>::difference_type n;
|
||||||
b = i1 < i2;
|
b = i1 < i2;
|
||||||
b = i1 <= i2;
|
b = i1 <= i2;
|
||||||
b = i1 > i2;
|
b = i1 > i2;
|
||||||
b = i1 >= i2;
|
b = i1 >= i2;
|
||||||
n = i1 - i2;
|
n = i1 - i2;
|
||||||
|
|
||||||
b = i2 < i1;
|
b = i2 < i1;
|
||||||
b = i2 <= i1;
|
b = i2 <= i1;
|
||||||
b = i2 > i1;
|
b = i2 > i1;
|
||||||
b = i2 >= i1;
|
b = i2 >= i1;
|
||||||
n = i2 - i1;
|
n = i2 - i1;
|
||||||
|
boost::ignore_unused_variable_warning(b);
|
||||||
|
boost::ignore_unused_variable_warning(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator1, typename Iterator2>
|
template <typename Iterator1, typename Iterator2>
|
||||||
void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2,
|
void interop_rand_access_constraints(
|
||||||
boost::single_pass_traversal_tag, boost::single_pass_traversal_tag)
|
Iterator1 const&, Iterator2 const&,
|
||||||
|
boost::single_pass_traversal_tag, boost::single_pass_traversal_tag)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename Iterator, typename ConstIterator>
|
BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator))
|
||||||
class InteroperableIteratorConcept
|
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
typedef typename boost::detail::pure_traversal_tag<
|
typedef typename boost::detail::pure_traversal_tag<
|
||||||
typename boost::iterator_traversal<
|
typename boost::iterator_traversal<
|
||||||
Iterator
|
Iterator
|
||||||
@ -287,22 +259,26 @@ namespace boost_concepts {
|
|||||||
ConstIterator
|
ConstIterator
|
||||||
>::type
|
>::type
|
||||||
>::type const_traversal_category;
|
>::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_single_pass_constraints(i, ci);
|
||||||
detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category());
|
detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category());
|
||||||
|
|
||||||
ci = i;
|
ci = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
Iterator i;
|
Iterator i;
|
||||||
ConstIterator ci;
|
ConstIterator ci;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace boost_concepts
|
} // namespace boost_concepts
|
||||||
|
|
||||||
|
#include <boost/concept/detail/concept_undef.hpp>
|
||||||
|
|
||||||
#endif // BOOST_ITERATOR_CONCEPTS_HPP
|
#endif // BOOST_ITERATOR_CONCEPTS_HPP
|
||||||
|
@ -106,7 +106,7 @@ namespace boost
|
|||||||
typedef typename remove_const<ValueParam>::type value_type;
|
typedef typename remove_const<ValueParam>::type value_type;
|
||||||
|
|
||||||
typedef typename mpl::eval_if<
|
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<const value_type>
|
||||||
, add_pointer<value_type>
|
, add_pointer<value_type>
|
||||||
>::type pointer;
|
>::type pointer;
|
||||||
@ -446,7 +446,7 @@ namespace boost
|
|||||||
class Derived1, class V1, class TC1, class R1, class D1 \
|
class Derived1, class V1, class TC1, class R1, class D1 \
|
||||||
, class Derived2, class V2, class TC2, class R2, class D2 \
|
, 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 \
|
Derived1, Derived2 \
|
||||||
, typename mpl::apply2<result_type,Derived1,Derived2>::type \
|
, typename mpl::apply2<result_type,Derived1,Derived2>::type \
|
||||||
>::type \
|
>::type \
|
||||||
@ -480,7 +480,7 @@ namespace boost
|
|||||||
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> friend class iterator_facade;
|
||||||
|
|
||||||
# define BOOST_ITERATOR_FACADE_RELATION(op) \
|
# 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(==)
|
||||||
BOOST_ITERATOR_FACADE_RELATION(!=)
|
BOOST_ITERATOR_FACADE_RELATION(!=)
|
||||||
@ -492,7 +492,7 @@ namespace boost
|
|||||||
# undef BOOST_ITERATOR_FACADE_RELATION
|
# undef BOOST_ITERATOR_FACADE_RELATION
|
||||||
|
|
||||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(
|
BOOST_ITERATOR_FACADE_INTEROP_HEAD(
|
||||||
friend, -, detail::choose_difference_type)
|
friend, -, boost::detail::choose_difference_type)
|
||||||
;
|
;
|
||||||
|
|
||||||
BOOST_ITERATOR_FACADE_PLUS_HEAD(
|
BOOST_ITERATOR_FACADE_PLUS_HEAD(
|
||||||
@ -594,7 +594,7 @@ namespace boost
|
|||||||
>
|
>
|
||||||
class iterator_facade
|
class iterator_facade
|
||||||
# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||||
: public detail::iterator_facade_types<
|
: public boost::detail::iterator_facade_types<
|
||||||
Value, CategoryOrTraversal, Reference, Difference
|
Value, CategoryOrTraversal, Reference, Difference
|
||||||
>::base
|
>::base
|
||||||
# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||||
@ -614,7 +614,7 @@ namespace boost
|
|||||||
return *static_cast<Derived const*>(this);
|
return *static_cast<Derived const*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef detail::iterator_facade_types<
|
typedef boost::detail::iterator_facade_types<
|
||||||
Value, CategoryOrTraversal, Reference, Difference
|
Value, CategoryOrTraversal, Reference, Difference
|
||||||
> associated_types;
|
> associated_types;
|
||||||
|
|
||||||
@ -635,26 +635,26 @@ namespace boost
|
|||||||
return iterator_core_access::dereference(this->derived());
|
return iterator_core_access::dereference(this->derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
typename detail::operator_arrow_result<
|
typename boost::detail::operator_arrow_result<
|
||||||
value_type
|
value_type
|
||||||
, reference
|
, reference
|
||||||
, pointer
|
, pointer
|
||||||
>::type
|
>::type
|
||||||
operator->() const
|
operator->() const
|
||||||
{
|
{
|
||||||
return detail::operator_arrow_result<
|
return boost::detail::operator_arrow_result<
|
||||||
value_type
|
value_type
|
||||||
, reference
|
, reference
|
||||||
, pointer
|
, pointer
|
||||||
>::make(*this->derived());
|
>::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
|
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
|
this->derived() + n
|
||||||
, use_proxy()
|
, use_proxy()
|
||||||
);
|
);
|
||||||
@ -667,10 +667,10 @@ namespace boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
# 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)
|
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());
|
tmp(this->derived());
|
||||||
++*this;
|
++*this;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -723,13 +723,13 @@ namespace boost
|
|||||||
|
|
||||||
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
template <class I, class V, class TC, class R, class D>
|
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++(
|
operator++(
|
||||||
iterator_facade<I,V,TC,R,D>& i
|
iterator_facade<I,V,TC,R,D>& i
|
||||||
, int
|
, 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));
|
tmp(*static_cast<I*>(&i));
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
@ -829,7 +829,7 @@ namespace boost
|
|||||||
# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
|
# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
|
||||||
BOOST_ITERATOR_FACADE_INTEROP( \
|
BOOST_ITERATOR_FACADE_INTEROP( \
|
||||||
op \
|
op \
|
||||||
, detail::always_bool2 \
|
, boost::detail::always_bool2 \
|
||||||
, return_prefix \
|
, return_prefix \
|
||||||
, base_op \
|
, base_op \
|
||||||
)
|
)
|
||||||
@ -846,7 +846,7 @@ namespace boost
|
|||||||
// operator- requires an additional part in the static assertion
|
// operator- requires an additional part in the static assertion
|
||||||
BOOST_ITERATOR_FACADE_INTEROP(
|
BOOST_ITERATOR_FACADE_INTEROP(
|
||||||
-
|
-
|
||||||
, detail::choose_difference_type
|
, boost::detail::choose_difference_type
|
||||||
, return
|
, return
|
||||||
, distance_from
|
, distance_from
|
||||||
)
|
)
|
||||||
|
@ -27,32 +27,32 @@ namespace boost {
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
struct iterator_value
|
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>
|
template <class Iterator>
|
||||||
struct iterator_reference
|
struct iterator_reference
|
||||||
{
|
{
|
||||||
typedef typename detail::iterator_traits<Iterator>::reference type;
|
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
struct iterator_pointer
|
struct iterator_pointer
|
||||||
{
|
{
|
||||||
typedef typename detail::iterator_traits<Iterator>::pointer type;
|
typedef typename boost::detail::iterator_traits<Iterator>::pointer type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
struct iterator_difference
|
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>
|
template <class Iterator>
|
||||||
struct BOOST_ITERATOR_CATEGORY
|
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)
|
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||||
|
@ -37,10 +37,10 @@ namespace boost
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class UnaryFunction>
|
template <class UnaryFunc>
|
||||||
struct function_object_result
|
struct function_object_result
|
||||||
{
|
{
|
||||||
typedef typename UnaryFunction::result_type type;
|
typedef typename UnaryFunc::result_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
@ -52,7 +52,7 @@ namespace boost
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Compute the iterator_adaptor instantiation to be used for transform_iterator
|
// 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
|
struct transform_iterator_base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -62,7 +62,7 @@ namespace boost
|
|||||||
// proposal (e.g. using Doug's result_of)?
|
// proposal (e.g. using Doug's result_of)?
|
||||||
typedef typename ia_dflt_help<
|
typedef typename ia_dflt_help<
|
||||||
Reference
|
Reference
|
||||||
, function_object_result<UnaryFunction>
|
, function_object_result<UnaryFunc>
|
||||||
>::type reference;
|
>::type reference;
|
||||||
|
|
||||||
// To get the default for Value: remove any reference on the
|
// To get the default for Value: remove any reference on the
|
||||||
@ -77,7 +77,7 @@ namespace boost
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
typedef iterator_adaptor<
|
typedef iterator_adaptor<
|
||||||
transform_iterator<UnaryFunction, Iterator, Reference, Value>
|
transform_iterator<UnaryFunc, Iterator, Reference, Value>
|
||||||
, Iterator
|
, Iterator
|
||||||
, cv_value_type
|
, cv_value_type
|
||||||
, use_default // Leave the traversal category alone
|
, 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
|
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
|
typedef typename
|
||||||
detail::transform_iterator_base<UnaryFunction, Iterator, Reference, Value>::type
|
boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
||||||
super_t;
|
super_t;
|
||||||
|
|
||||||
friend class iterator_core_access;
|
friend class iterator_core_access;
|
||||||
@ -99,7 +99,7 @@ namespace boost
|
|||||||
public:
|
public:
|
||||||
transform_iterator() { }
|
transform_iterator() { }
|
||||||
|
|
||||||
transform_iterator(Iterator const& x, UnaryFunction f)
|
transform_iterator(Iterator const& x, UnaryFunc f)
|
||||||
: super_t(x), m_f(f) { }
|
: super_t(x), m_f(f) { }
|
||||||
|
|
||||||
explicit transform_iterator(Iterator const& x)
|
explicit transform_iterator(Iterator const& x)
|
||||||
@ -108,9 +108,9 @@ namespace boost
|
|||||||
// Pro8 is a little too aggressive about instantiating the
|
// Pro8 is a little too aggressive about instantiating the
|
||||||
// body of this function.
|
// body of this function.
|
||||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
#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.
|
// 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,13 +123,13 @@ namespace boost
|
|||||||
transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
|
transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
|
||||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
||||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||||
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunction>::type* = 0
|
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
: super_t(t.base()), m_f(t.functor())
|
: super_t(t.base()), m_f(t.functor())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
UnaryFunction functor() const
|
UnaryFunc functor() const
|
||||||
{ return m_f; }
|
{ return m_f; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -138,38 +138,38 @@ namespace boost
|
|||||||
|
|
||||||
// Probably should be the initial base class so it can be
|
// Probably should be the initial base class so it can be
|
||||||
// optimized away via EBO if it is an empty class.
|
// optimized away via EBO if it is an empty class.
|
||||||
UnaryFunction m_f;
|
UnaryFunc m_f;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class UnaryFunction, class Iterator>
|
template <class UnaryFunc, class Iterator>
|
||||||
transform_iterator<UnaryFunction, Iterator>
|
transform_iterator<UnaryFunc, Iterator>
|
||||||
make_transform_iterator(Iterator it, UnaryFunction fun)
|
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.
|
// 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
|
// pointer type, because it's too dangerous: the default-constructed
|
||||||
// function pointer in the iterator be 0, leading to a runtime
|
// function pointer in the iterator be 0, leading to a runtime
|
||||||
// crash.
|
// crash.
|
||||||
template <class UnaryFunction, class Iterator>
|
template <class UnaryFunc, class Iterator>
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
typename mpl::if_<
|
typename mpl::if_<
|
||||||
#else
|
#else
|
||||||
typename iterators::enable_if<
|
typename iterators::enable_if<
|
||||||
#endif
|
#endif
|
||||||
is_class<UnaryFunction> // We should probably find a cheaper test than is_class<>
|
is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
|
||||||
, transform_iterator<UnaryFunction, Iterator>
|
, transform_iterator<UnaryFunc, Iterator>
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
, int[3]
|
, int[3]
|
||||||
#endif
|
#endif
|
||||||
>::type
|
>::type
|
||||||
make_transform_iterator(Iterator it)
|
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)
|
#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
|
// Copyright David Abrahams 2004. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying
|
// Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// 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
|
#ifndef ITERATOR_ADAPTORS_DWA2004725_HPP
|
||||||
# define ITERATOR_ADAPTORS_DWA2004725_HPP
|
# define ITERATOR_ADAPTORS_DWA2004725_HPP
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user