mirror of
https://github.com/boostorg/iterator.git
synced 2025-06-30 22:41:10 +02:00
Compare commits
1 Commits
boost-1.27
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
edcea5d276 |
@ -135,15 +135,7 @@ namespace detail {
|
||||
// For a while, this wasn't true, but we rely on it below. This is a regression assert.
|
||||
BOOST_STATIC_ASSERT(::boost::is_integral<char>::value);
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
# if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = (
|
||||
std::numeric_limits<T>::is_specialized
|
||||
| boost::is_same<T,long long>::value
|
||||
| boost::is_same<T,unsigned long long>::value));
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<T>::is_specialized);
|
||||
# endif
|
||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<T>::is_specialized);
|
||||
# else
|
||||
# if !defined(__BORLANDC__)
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
@ -181,17 +173,14 @@ struct counting_iterator_traits {
|
||||
template <class Incrementable>
|
||||
struct counting_iterator_policies : public default_iterator_policies
|
||||
{
|
||||
template <class IteratorAdaptor>
|
||||
typename IteratorAdaptor::reference dereference(const IteratorAdaptor& i) const
|
||||
{ return i.base(); }
|
||||
|
||||
template <class Iterator1, class Iterator2>
|
||||
typename Iterator1::difference_type distance(
|
||||
const Iterator1& x, const Iterator2& y) const
|
||||
const Incrementable& dereference(type<const Incrementable&>, const Incrementable& i) const
|
||||
{ return i; }
|
||||
|
||||
template <class Difference, class Iterator1, class Iterator2>
|
||||
Difference distance(type<Difference>, const Iterator1& x,
|
||||
const Iterator2& y) const
|
||||
{
|
||||
typedef typename Iterator1::difference_type difference_type;
|
||||
return boost::detail::any_distance<difference_type>(
|
||||
x.base(), y.base());
|
||||
return boost::detail::any_distance<Difference>(x, y);//,(Difference*)());
|
||||
}
|
||||
};
|
||||
|
||||
@ -199,20 +188,15 @@ struct counting_iterator_policies : public default_iterator_policies
|
||||
template <class Incrementable>
|
||||
struct counting_iterator_generator
|
||||
{
|
||||
typedef typename boost::remove_const<
|
||||
Incrementable
|
||||
>::type value_type;
|
||||
typedef counting_iterator_traits<Incrementable> traits;
|
||||
|
||||
typedef counting_iterator_traits<value_type> traits;
|
||||
|
||||
typedef iterator_adaptor<
|
||||
value_type
|
||||
, counting_iterator_policies<value_type>
|
||||
, value_type
|
||||
, value_type const&
|
||||
, value_type const*
|
||||
, typename traits::iterator_category
|
||||
, typename traits::difference_type
|
||||
typedef iterator_adaptor<Incrementable,
|
||||
counting_iterator_policies<Incrementable>,
|
||||
Incrementable,
|
||||
const Incrementable&,
|
||||
const Incrementable*,
|
||||
typename traits::iterator_category,
|
||||
typename traits::difference_type
|
||||
> type;
|
||||
};
|
||||
|
||||
|
@ -99,17 +99,17 @@ struct half_open_range
|
||||
|
||||
public:
|
||||
typedef iter_t const_iterator;
|
||||
typedef typename iterator::value_type value_type;
|
||||
typedef typename iterator::difference_type difference_type;
|
||||
typedef typename iterator::reference reference;
|
||||
typedef typename iterator::reference const_reference;
|
||||
typedef typename iterator::pointer pointer;
|
||||
typedef typename iterator::pointer const_pointer;
|
||||
typedef typename counting_iterator_traits<Incrementable>::value_type value_type;
|
||||
typedef typename counting_iterator_traits<Incrementable>::difference_type difference_type;
|
||||
typedef typename counting_iterator_traits<Incrementable>::reference reference;
|
||||
typedef typename counting_iterator_traits<Incrementable>::reference const_reference;
|
||||
typedef typename counting_iterator_traits<Incrementable>::pointer pointer;
|
||||
typedef typename counting_iterator_traits<Incrementable>::pointer const_pointer;
|
||||
|
||||
// It would be nice to select an unsigned type, but this is appropriate
|
||||
// since the library makes an attempt to select a difference_type which can
|
||||
// hold the difference between any two iterators.
|
||||
typedef typename iterator::difference_type size_type;
|
||||
typedef typename counting_iterator_traits<Incrementable>::difference_type size_type;
|
||||
|
||||
half_open_range(Incrementable start, Incrementable finish)
|
||||
: m_start(start),
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
# if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR)
|
||||
# ifdef BOOST_NO_STD_ITERATOR
|
||||
template <class Category, class T,
|
||||
class Distance = std::ptrdiff_t,
|
||||
class Pointer = T*, class Reference = T&>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
// (C) Copyright Toon Knapen 2001. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#ifndef boost_permutation_iterator_hpp
|
||||
#define boost_permutation_iterator_hpp
|
||||
|
||||
#include <boost/iterator_adaptors.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template < typename IndexIterator >
|
||||
struct permutation_iterator_policies : public default_iterator_policies
|
||||
{
|
||||
permutation_iterator_policies() {}
|
||||
|
||||
permutation_iterator_policies(IndexIterator order_it)
|
||||
: order_it_( order_it )
|
||||
{}
|
||||
|
||||
template <class IteratorAdaptor>
|
||||
typename IteratorAdaptor::reference dereference(const IteratorAdaptor& x) const
|
||||
{ return *(x.base() + *order_it_); }
|
||||
|
||||
template <class IteratorAdaptor>
|
||||
void increment(IteratorAdaptor&)
|
||||
{ ++order_it_; }
|
||||
|
||||
template <class IteratorAdaptor>
|
||||
void decrement(IteratorAdaptor&)
|
||||
{ --order_it_; }
|
||||
|
||||
template <class IteratorAdaptor, class DifferenceType>
|
||||
void advance(IteratorAdaptor& x, DifferenceType n)
|
||||
{ std::advance( order_it_, n ); }
|
||||
|
||||
template <class IteratorAdaptor1, class IteratorAdaptor2>
|
||||
typename IteratorAdaptor1::difference_type
|
||||
distance(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const
|
||||
{ return std::distance( x.policies().order_it_, y.policies().order_it_ ); }
|
||||
|
||||
template <class IteratorAdaptor1, class IteratorAdaptor2>
|
||||
bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const
|
||||
{ return x.policies().order_it_ == y.policies().order_it_; }
|
||||
|
||||
IndexIterator order_it_;
|
||||
};
|
||||
|
||||
template < typename ElementIterator, typename IndexIterator >
|
||||
struct permutation_iterator_generator
|
||||
{
|
||||
typedef boost::iterator_adaptor
|
||||
< ElementIterator,
|
||||
permutation_iterator_policies< IndexIterator >
|
||||
> type;
|
||||
};
|
||||
|
||||
template < class IndexIterator, class ElementIterator >
|
||||
inline typename permutation_iterator_generator< ElementIterator, IndexIterator >::type
|
||||
make_permutation_iterator(ElementIterator base, IndexIterator order)
|
||||
{
|
||||
typedef typename permutation_iterator_generator< ElementIterator, IndexIterator >::type result_t;
|
||||
return result_t( base, order );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // boost_permutation_iterator_hpp
|
||||
|
Reference in New Issue
Block a user