mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
next, prev 修正
This commit is contained in:
parent
ed469abdda
commit
a52257117e
2 changed files with 14 additions and 8 deletions
|
@ -57,9 +57,10 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
SPROUT_CONSTEXPR typename std::decay<Iterator>::type next(Iterator&& it) {
|
SPROUT_CONSTEXPR typename std::decay<Iterator>::type next(Iterator&& it) {
|
||||||
|
typedef typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category* category;
|
||||||
return sprout::detail::next_impl(
|
return sprout::detail::next_impl(
|
||||||
sprout::forward<Iterator>(it),
|
sprout::forward<Iterator>(it),
|
||||||
static_cast<typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category*>(nullptr)
|
category()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
|
@ -68,10 +69,11 @@ namespace sprout {
|
||||||
typename std::iterator_traits<typename std::decay<Iterator>::type>::difference_type n
|
typename std::iterator_traits<typename std::decay<Iterator>::type>::difference_type n
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
typedef typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category* category;
|
||||||
return sprout::detail::next_impl(
|
return sprout::detail::next_impl(
|
||||||
sprout::forward<Iterator>(it),
|
sprout::forward<Iterator>(it),
|
||||||
n,
|
n,
|
||||||
static_cast<typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category*>(nullptr)
|
category()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
|
@ -20,12 +20,13 @@ namespace sprout {
|
||||||
return sprout::forward<Iterator>(it) - 1;
|
return sprout::forward<Iterator>(it) - 1;
|
||||||
}
|
}
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
Iterator prev_impl(
|
SPROUT_CONSTEXPR typename std::decay<Iterator>::type prev_impl(
|
||||||
Iterator&& it,
|
Iterator&& it,
|
||||||
void*
|
void*
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::prev(sprout::forward<Iterator>(it));
|
using std::prev;
|
||||||
|
return prev(sprout::forward<Iterator>(it));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
|
@ -41,13 +42,14 @@ namespace sprout {
|
||||||
return sprout::forward<Iterator>(it) - n;
|
return sprout::forward<Iterator>(it) - n;
|
||||||
}
|
}
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
Iterator prev_impl(
|
SPROUT_CONSTEXPR typename std::decay<Iterator>::type prev_impl(
|
||||||
Iterator it,
|
Iterator it,
|
||||||
typename std::iterator_traits<typename std::decay<Iterator>::type>::difference_type n,
|
typename std::iterator_traits<typename std::decay<Iterator>::type>::difference_type n,
|
||||||
void*
|
void*
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::prev(sprout::forward<Iterator>(it), n);
|
using std::prev;
|
||||||
|
return prev(sprout::forward<Iterator>(it), n);
|
||||||
}
|
}
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
//
|
//
|
||||||
|
@ -55,9 +57,10 @@ namespace sprout {
|
||||||
//
|
//
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
SPROUT_CONSTEXPR typename std::decay<Iterator>::type prev(Iterator&& it) {
|
SPROUT_CONSTEXPR typename std::decay<Iterator>::type prev(Iterator&& it) {
|
||||||
|
typedef typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category* category;
|
||||||
return sprout::detail::prev_impl(
|
return sprout::detail::prev_impl(
|
||||||
sprout::forward<Iterator>(it),
|
sprout::forward<Iterator>(it),
|
||||||
static_cast<typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category*>(nullptr)
|
category()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
|
@ -66,10 +69,11 @@ namespace sprout {
|
||||||
typename std::iterator_traits<typename std::decay<Iterator>::type>::difference_type n
|
typename std::iterator_traits<typename std::decay<Iterator>::type>::difference_type n
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
typedef typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category* category;
|
||||||
return sprout::detail::prev_impl(
|
return sprout::detail::prev_impl(
|
||||||
sprout::forward<Iterator>(it),
|
sprout::forward<Iterator>(it),
|
||||||
n,
|
n,
|
||||||
static_cast<typename std::iterator_traits<typename std::decay<Iterator>::type>::iterator_category*>(nullptr)
|
category()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
Loading…
Reference in a new issue