Author: | Thorsten Ottosen |
---|---|
Contact: | tottosen@dezide.com |
organizations: | Dezide Aps |
Date: | 2006-09-08 |
Number: | WG21/N2099 and J16/06-0169 (revision of n1870) |
Working Group: | Evolution |
Abstract
This paper provides wording for 3 of the least controversial of the 14 crazy ideas for enhancing the standard library.
The motivation for these additions is discussed in n1870.
Each numbered section below describes a new section for the standard or modifications to an existing section. Comments are written in bold and are not part of the wording. Footnotes are not part of the wording.
Extend the synopsis after distance() of 23.2 to include:
template<class ForwardIterator> ForwardIterator next(ForwardIterator x, typename std::iterator_traits<ForwardIterator>::difference_type n = 1); template< class ForwardIterator > ForwardIterator prior(ForwardIterator x, typename std::iterator_traits<ForwardIterator>::difference_type n = 1);
Extend 24.3.4 to include:
template<class ForwardIterator> ForwardIterator next(ForwardIterator x, typename std::iterator_traits<ForwardIterator>::difference_type n = 1);
template<class ForwardIterator> ForwardIterator prior(ForwardIterator x, typename std::iterator_traits<ForwardIterator>::difference_type n = 1);
Add the following as paragraphs:
template<class ForwardIterator> RandomAccessIterator is_sorted_until(ForwardIterator first, ForwardIterator last);
template<class ForwardIterator, class Compare> RandomAccessIterator is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp );
template<class ForwardIterator> bool is_sorted(ForwardIterator first, ForwardIterator last);
template<class ForwardIterator, class Compare> bool is_sorted(ForwardIterator first, ForwardIterator last, Compare comp );
template <class RandomAccessIterator> bool is_heap(RandomAccessIterator first, RandomAccessIterator last);
template <class RandomAccessIterator, class Compare> bool is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
Extend the synopsis after adjacent_difference() of 26.6 to include:
template< class T, class InputIterator > T mean( InputIterator first, InputIterator last ); template< class T, class ForwardIterator > T variance( ForwardIterator first, ForwardIterator last );
Add the following as paragraphs:
template< class T, class InputIterator > T mean( InputIterator first, InputIterator last );
template< class T, class ForwardIterator > T variance( ForwardIterator first, ForwardIterator last );
[1] | At the Berlin meeting we discussed that I could choose to provide wording for is_heap_until() just like we have wording for is_sorted_until(). However, I have no idea of how to use, implement nor specify the requirement of such a beast. Is it even possible? |
[2] | A single pass algorithm is prone to floating point inaccuracies. |