fix next, prev implementation and adapt-interface

This commit is contained in:
bolero-MURAKAMI 2012-09-26 16:31:11 +09:00
parent 69910ca06c
commit a4c7df65e0
19 changed files with 679 additions and 639 deletions

View file

@ -190,44 +190,6 @@ namespace sprout {
lhs.swap(rhs);
}
//
// next
//
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> next(
sprout::counting_iterator<Incrementable> const& it
)
{
return it.next();
}
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> next(
sprout::counting_iterator<Incrementable> const& it,
typename sprout::counting_iterator<Incrementable>::difference_type n
)
{
return it + n;
}
//
// prev
//
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> prev(
sprout::counting_iterator<Incrementable> const& it
)
{
return it.prev();
}
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> prev(
sprout::counting_iterator<Incrementable> const& it,
typename sprout::counting_iterator<Incrementable>::difference_type n
)
{
return it - n;
}
//
// distance
//
@ -240,6 +202,44 @@ namespace sprout {
{
return last - first;
}
//
// iterator_next
//
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_next(
sprout::counting_iterator<Incrementable> const& it
)
{
return it.next();
}
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_next(
sprout::counting_iterator<Incrementable> const& it,
typename sprout::counting_iterator<Incrementable>::difference_type n
)
{
return it + n;
}
//
// iterator_prev
//
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_prev(
sprout::counting_iterator<Incrementable> const& it
)
{
return it.prev();
}
template<typename Incrementable>
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_prev(
sprout::counting_iterator<Incrementable> const& it,
typename sprout::counting_iterator<Incrementable>::difference_type n
)
{
return it - n;
}
} // namespace sprout
#endif // #ifndef SPROUT_ITERATOR_COUNTING_ITERATOR_HPP