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
|
||||
{
|
||||
typedef typename mpl::apply_if<
|
||||
is_same<Category, not_specified>
|
||||
is_same<Category, use_default>
|
||||
, mpl::apply_if<
|
||||
is_numeric<Incrementable>
|
||||
, mpl::identity<std::random_access_iterator_tag>
|
||||
@@ -81,7 +81,7 @@ namespace detail
|
||||
>::type category;
|
||||
|
||||
typedef typename mpl::apply_if<
|
||||
is_same<Difference, not_specified>
|
||||
is_same<Difference, use_default>
|
||||
, mpl::apply_if<
|
||||
is_numeric<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
|
||||
: public detail::counting_iterator_base<Incrementable, Category, Difference>::type
|
||||
{
|
||||
|
@@ -35,13 +35,13 @@ namespace boost
|
||||
class filter_iterator
|
||||
: public iterator_adaptor<
|
||||
filter_iterator<Predicate, Iterator>, Iterator
|
||||
, not_specified
|
||||
, use_default
|
||||
, typename detail::filter_iterator_category<Iterator>::type
|
||||
>
|
||||
{
|
||||
typedef iterator_adaptor<
|
||||
filter_iterator<Predicate, Iterator>, Iterator
|
||||
, not_specified
|
||||
, use_default
|
||||
, typename detail::filter_iterator_category<Iterator>::type
|
||||
> super_t;
|
||||
|
||||
|
@@ -154,11 +154,11 @@ namespace boost
|
||||
|
||||
template <
|
||||
class Iterator
|
||||
, class Value = not_specified
|
||||
, class Category = not_specified
|
||||
, class Reference = not_specified
|
||||
, class Pointer = not_specified
|
||||
, class Difference = not_specified
|
||||
, class Value = use_default
|
||||
, class Category = use_default
|
||||
, class Reference = use_default
|
||||
, class Pointer = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class indirect_iterator
|
||||
: public detail::indirect_base<
|
||||
|
@@ -172,7 +172,7 @@ namespace boost
|
||||
struct ia_dflt_help
|
||||
: mpl::apply_if<
|
||||
mpl::and_<
|
||||
is_same<T, not_specified>
|
||||
is_same<T, use_default>
|
||||
, Condition
|
||||
>
|
||||
, DefaultNullaryFn
|
||||
@@ -196,8 +196,8 @@ namespace boost
|
||||
Derived
|
||||
, 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<Reference , is_same<Value, not_specified> , iterator_reference<Base> >::type
|
||||
, typename detail::ia_dflt_help<Pointer , is_same<Value, not_specified> , iterator_pointer<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, use_default> , iterator_pointer<Base> >::type
|
||||
, typename detail::ia_dflt_help<Difference , mpl::true_ , iterator_difference<Base> >::type
|
||||
>
|
||||
type;
|
||||
@@ -211,11 +211,11 @@ namespace boost
|
||||
template <
|
||||
class Derived
|
||||
, class Base
|
||||
, class Value = not_specified
|
||||
, class Category = not_specified
|
||||
, class Reference = not_specified
|
||||
, class Pointer = not_specified
|
||||
, class Difference = not_specified
|
||||
, class Value = use_default
|
||||
, class Category = use_default
|
||||
, class Reference = use_default
|
||||
, class Pointer = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class iterator_adaptor
|
||||
: public detail::iterator_adaptor_base<
|
||||
|
@@ -29,7 +29,7 @@
|
||||
namespace boost
|
||||
{
|
||||
|
||||
struct not_specified;
|
||||
struct use_default;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
@@ -67,6 +67,12 @@ namespace boost
|
||||
// Generates the corresponding std::iterator specialization
|
||||
// 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>
|
||||
struct iterator_facade_base
|
||||
{
|
||||
@@ -78,13 +84,13 @@ namespace boost
|
||||
, Difference
|
||||
|
||||
, typename mpl::if_<
|
||||
is_same<Pointer, not_specified>
|
||||
is_same<Pointer, use_default>
|
||||
, Value*
|
||||
, Pointer
|
||||
>::type
|
||||
|
||||
, typename mpl::if_<
|
||||
is_same<Reference, not_specified>
|
||||
is_same<Reference, use_default>
|
||||
, Value&
|
||||
, Reference
|
||||
>::type
|
||||
@@ -263,9 +269,9 @@ namespace boost
|
||||
class Derived
|
||||
, class Value
|
||||
, class Category
|
||||
, class Reference = not_specified
|
||||
, class Pointer = not_specified
|
||||
, class Difference = not_specified
|
||||
, class Reference = Value&
|
||||
, class Pointer = Value*
|
||||
, class Difference = std::ptrdiff_t
|
||||
>
|
||||
class iterator_facade
|
||||
: public detail::iterator_facade_base<Value, Category, Reference, Pointer, Difference>::type
|
||||
|
@@ -24,16 +24,22 @@ namespace boost
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Given the transform iterator's transformation and iterator, this
|
||||
// is the type used as its traits.
|
||||
template <class UnaryFunction, class Iterator>
|
||||
struct transform_iterator_base
|
||||
{
|
||||
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 remove_reference< result_type >::type cv_value_type;
|
||||
typedef typename remove_cv< cv_value_type >::type value_type;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
is_reference< result_type >
|
||||
@@ -62,6 +68,7 @@ namespace boost
|
||||
, result_type
|
||||
> type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class AdaptableUnaryFunction, class Iterator>
|
||||
|
Reference in New Issue
Block a user