mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-16 15:14:13 +00:00
fix next, prev implementation and adapt-interface
This commit is contained in:
parent
69910ca06c
commit
a4c7df65e0
19 changed files with 679 additions and 639 deletions
|
@ -195,44 +195,6 @@ namespace sprout {
|
|||
: public std::true_type
|
||||
{};
|
||||
|
||||
//
|
||||
// next
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> next(
|
||||
sprout::index_iterator<Container> const& it
|
||||
)
|
||||
{
|
||||
return it.next();
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> next(
|
||||
sprout::index_iterator<Container> const& it,
|
||||
typename sprout::index_iterator<Container>::difference_type n
|
||||
)
|
||||
{
|
||||
return it + n;
|
||||
}
|
||||
|
||||
//
|
||||
// prev
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> prev(
|
||||
sprout::index_iterator<Container> const& it
|
||||
)
|
||||
{
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> prev(
|
||||
sprout::index_iterator<Container> const& it,
|
||||
typename sprout::index_iterator<Container>::difference_type n
|
||||
)
|
||||
{
|
||||
return it - n;
|
||||
}
|
||||
|
||||
//
|
||||
// distance
|
||||
//
|
||||
|
@ -245,6 +207,44 @@ namespace sprout {
|
|||
{
|
||||
return last - first;
|
||||
}
|
||||
|
||||
//
|
||||
// iterator_next
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_next(
|
||||
sprout::index_iterator<Container> const& it
|
||||
)
|
||||
{
|
||||
return it.next();
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_next(
|
||||
sprout::index_iterator<Container> const& it,
|
||||
typename sprout::index_iterator<Container>::difference_type n
|
||||
)
|
||||
{
|
||||
return it + n;
|
||||
}
|
||||
|
||||
//
|
||||
// iterator_prev
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_prev(
|
||||
sprout::index_iterator<Container> const& it
|
||||
)
|
||||
{
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_prev(
|
||||
sprout::index_iterator<Container> const& it,
|
||||
typename sprout::index_iterator<Container>::difference_type n
|
||||
)
|
||||
{
|
||||
return it - n;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_INDEX_ITERATOR_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue