mirror of
https://github.com/boostorg/iterator.git
synced 2025-10-01 03:30:57 +02:00
Updated to current proposal.
[SVN r1209]
This commit is contained in:
@@ -71,7 +71,7 @@ namespace detail
|
|||||||
struct counting_iterator_base
|
struct counting_iterator_base
|
||||||
{
|
{
|
||||||
typedef typename mpl::apply_if<
|
typedef typename mpl::apply_if<
|
||||||
is_same<Category, not_specified>
|
is_same<Category, use_default>
|
||||||
, mpl::apply_if<
|
, mpl::apply_if<
|
||||||
is_numeric<Incrementable>
|
is_numeric<Incrementable>
|
||||||
, mpl::identity<std::random_access_iterator_tag>
|
, mpl::identity<std::random_access_iterator_tag>
|
||||||
@@ -81,7 +81,7 @@ namespace detail
|
|||||||
>::type category;
|
>::type category;
|
||||||
|
|
||||||
typedef typename mpl::apply_if<
|
typedef typename mpl::apply_if<
|
||||||
is_same<Difference, not_specified>
|
is_same<Difference, use_default>
|
||||||
, mpl::apply_if<
|
, mpl::apply_if<
|
||||||
is_numeric<Incrementable>
|
is_numeric<Incrementable>
|
||||||
, numeric_difference<Incrementable>
|
, numeric_difference<Incrementable>
|
||||||
@@ -129,7 +129,7 @@ namespace detail
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Incrementable, class Category = not_specified, class Difference = not_specified>
|
template <class Incrementable, class Category = use_default, class Difference = use_default>
|
||||||
class counting_iterator
|
class counting_iterator
|
||||||
: public detail::counting_iterator_base<Incrementable, Category, Difference>::type
|
: public detail::counting_iterator_base<Incrementable, Category, Difference>::type
|
||||||
{
|
{
|
||||||
|
@@ -35,13 +35,13 @@ namespace boost
|
|||||||
class filter_iterator
|
class filter_iterator
|
||||||
: public iterator_adaptor<
|
: public iterator_adaptor<
|
||||||
filter_iterator<Predicate, Iterator>, Iterator
|
filter_iterator<Predicate, Iterator>, Iterator
|
||||||
, not_specified
|
, use_default
|
||||||
, typename detail::filter_iterator_category<Iterator>::type
|
, typename detail::filter_iterator_category<Iterator>::type
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
typedef iterator_adaptor<
|
typedef iterator_adaptor<
|
||||||
filter_iterator<Predicate, Iterator>, Iterator
|
filter_iterator<Predicate, Iterator>, Iterator
|
||||||
, not_specified
|
, use_default
|
||||||
, typename detail::filter_iterator_category<Iterator>::type
|
, typename detail::filter_iterator_category<Iterator>::type
|
||||||
> super_t;
|
> super_t;
|
||||||
|
|
||||||
|
@@ -154,11 +154,11 @@ namespace boost
|
|||||||
|
|
||||||
template <
|
template <
|
||||||
class Iterator
|
class Iterator
|
||||||
, class Value = not_specified
|
, class Value = use_default
|
||||||
, class Category = not_specified
|
, class Category = use_default
|
||||||
, class Reference = not_specified
|
, class Reference = use_default
|
||||||
, class Pointer = not_specified
|
, class Pointer = use_default
|
||||||
, class Difference = not_specified
|
, class Difference = use_default
|
||||||
>
|
>
|
||||||
class indirect_iterator
|
class indirect_iterator
|
||||||
: public detail::indirect_base<
|
: public detail::indirect_base<
|
||||||
|
@@ -172,7 +172,7 @@ namespace boost
|
|||||||
struct ia_dflt_help
|
struct ia_dflt_help
|
||||||
: mpl::apply_if<
|
: mpl::apply_if<
|
||||||
mpl::and_<
|
mpl::and_<
|
||||||
is_same<T, not_specified>
|
is_same<T, use_default>
|
||||||
, Condition
|
, Condition
|
||||||
>
|
>
|
||||||
, DefaultNullaryFn
|
, DefaultNullaryFn
|
||||||
@@ -196,8 +196,8 @@ namespace boost
|
|||||||
Derived
|
Derived
|
||||||
, typename detail::ia_dflt_help<Value , mpl::true_ , iterator_value<Base> >::type
|
, typename detail::ia_dflt_help<Value , mpl::true_ , iterator_value<Base> >::type
|
||||||
, typename detail::ia_dflt_help<Category , mpl::true_ , BOOST_ITERATOR_CATEGORY<Base> >::type
|
, typename detail::ia_dflt_help<Category , mpl::true_ , BOOST_ITERATOR_CATEGORY<Base> >::type
|
||||||
, typename detail::ia_dflt_help<Reference , is_same<Value, not_specified> , iterator_reference<Base> >::type
|
, typename detail::ia_dflt_help<Reference , is_same<Value, use_default> , iterator_reference<Base> >::type
|
||||||
, typename detail::ia_dflt_help<Pointer , is_same<Value, not_specified> , iterator_pointer<Base> >::type
|
, typename detail::ia_dflt_help<Pointer , is_same<Value, use_default> , iterator_pointer<Base> >::type
|
||||||
, typename detail::ia_dflt_help<Difference , mpl::true_ , iterator_difference<Base> >::type
|
, typename detail::ia_dflt_help<Difference , mpl::true_ , iterator_difference<Base> >::type
|
||||||
>
|
>
|
||||||
type;
|
type;
|
||||||
@@ -211,11 +211,11 @@ namespace boost
|
|||||||
template <
|
template <
|
||||||
class Derived
|
class Derived
|
||||||
, class Base
|
, class Base
|
||||||
, class Value = not_specified
|
, class Value = use_default
|
||||||
, class Category = not_specified
|
, class Category = use_default
|
||||||
, class Reference = not_specified
|
, class Reference = use_default
|
||||||
, class Pointer = not_specified
|
, class Pointer = use_default
|
||||||
, class Difference = not_specified
|
, class Difference = use_default
|
||||||
>
|
>
|
||||||
class iterator_adaptor
|
class iterator_adaptor
|
||||||
: public detail::iterator_adaptor_base<
|
: public detail::iterator_adaptor_base<
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
struct not_specified;
|
struct use_default;
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@@ -67,6 +67,12 @@ namespace boost
|
|||||||
// Generates the corresponding std::iterator specialization
|
// Generates the corresponding std::iterator specialization
|
||||||
// from the given iterator traits type
|
// from the given iterator traits type
|
||||||
//
|
//
|
||||||
|
// The use_default support is needed for iterator_adaptor.
|
||||||
|
// For practical reasons iterator_adaptor needs to specify
|
||||||
|
// fixed number of template arguments of iterator_facade.
|
||||||
|
// So use_default is its way to say what I really mean
|
||||||
|
// is youre default parameter.
|
||||||
|
//
|
||||||
template <class Value, class Category, class Reference, class Pointer, class Difference>
|
template <class Value, class Category, class Reference, class Pointer, class Difference>
|
||||||
struct iterator_facade_base
|
struct iterator_facade_base
|
||||||
{
|
{
|
||||||
@@ -78,13 +84,13 @@ namespace boost
|
|||||||
, Difference
|
, Difference
|
||||||
|
|
||||||
, typename mpl::if_<
|
, typename mpl::if_<
|
||||||
is_same<Pointer, not_specified>
|
is_same<Pointer, use_default>
|
||||||
, Value*
|
, Value*
|
||||||
, Pointer
|
, Pointer
|
||||||
>::type
|
>::type
|
||||||
|
|
||||||
, typename mpl::if_<
|
, typename mpl::if_<
|
||||||
is_same<Reference, not_specified>
|
is_same<Reference, use_default>
|
||||||
, Value&
|
, Value&
|
||||||
, Reference
|
, Reference
|
||||||
>::type
|
>::type
|
||||||
@@ -263,9 +269,9 @@ namespace boost
|
|||||||
class Derived
|
class Derived
|
||||||
, class Value
|
, class Value
|
||||||
, class Category
|
, class Category
|
||||||
, class Reference = not_specified
|
, class Reference = Value&
|
||||||
, class Pointer = not_specified
|
, class Pointer = Value*
|
||||||
, class Difference = not_specified
|
, class Difference = std::ptrdiff_t
|
||||||
>
|
>
|
||||||
class iterator_facade
|
class iterator_facade
|
||||||
: public detail::iterator_facade_base<Value, Category, Reference, Pointer, Difference>::type
|
: public detail::iterator_facade_base<Value, Category, Reference, Pointer, Difference>::type
|
||||||
|
@@ -24,16 +24,22 @@ namespace boost
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
// Given the transform iterator's transformation and iterator, this
|
// Given the transform iterator's transformation and iterator, this
|
||||||
// is the type used as its traits.
|
// is the type used as its traits.
|
||||||
template <class UnaryFunction, class Iterator>
|
template <class UnaryFunction, class Iterator>
|
||||||
struct transform_iterator_base
|
struct transform_iterator_base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// transform_iterator does not support writable/swappable iterators
|
||||||
|
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
|
BOOST_STATIC_ASSERT((is_tag< readable_iterator_tag, typename access_category<Iterator>::type >::value));
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef typename UnaryFunction::result_type result_type;
|
typedef typename UnaryFunction::result_type result_type;
|
||||||
|
|
||||||
typedef typename remove_reference< result_type >::type cv_value_type;
|
typedef typename remove_reference< result_type >::type cv_value_type;
|
||||||
typedef typename remove_cv< cv_value_type >::type value_type;
|
|
||||||
|
|
||||||
typedef typename mpl::if_<
|
typedef typename mpl::if_<
|
||||||
is_reference< result_type >
|
is_reference< result_type >
|
||||||
@@ -62,6 +68,7 @@ namespace boost
|
|||||||
, result_type
|
, result_type
|
||||||
> type;
|
> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class AdaptableUnaryFunction, class Iterator>
|
template <class AdaptableUnaryFunction, class Iterator>
|
||||||
|
Reference in New Issue
Block a user