S
Scott Meyers
I just noticed that the FDIS (and at least some older drafts) includes
specifications for next and prev funtions on iterators. They're just
shorthands for calls to advance:
template <class ForwardIterator>
ForwardIterator next(ForwardIterator x,
typename std::iterator_traits<ForwardIterator>::difference_type n = 1);
Effects: Equivalent to advance(x, n); return x;
template <class BidirectionalIterator>
BidirectionalIterator prev(BidirectionalIterator x,
typename std::iterator_traits<BidirectionalIterator>::difference_type n
= 1);
Effects: Equivalent to advance(x, -n); return x;
Does anybody happen to know the motivation for putting these functions
in the new standard?
Thanks,
Scott
specifications for next and prev funtions on iterators. They're just
shorthands for calls to advance:
template <class ForwardIterator>
ForwardIterator next(ForwardIterator x,
typename std::iterator_traits<ForwardIterator>::difference_type n = 1);
Effects: Equivalent to advance(x, n); return x;
template <class BidirectionalIterator>
BidirectionalIterator prev(BidirectionalIterator x,
typename std::iterator_traits<BidirectionalIterator>::difference_type n
= 1);
Effects: Equivalent to advance(x, -n); return x;
Does anybody happen to know the motivation for putting these functions
in the new standard?
Thanks,
Scott