Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2008-08-21 00:32:03


Author: dgregor
Date: 2008-08-21 00:32:01 EDT (Thu, 21 Aug 2008)
New Revision: 48277
URL: http://svn.boost.org/trac/boost/changeset/48277

Log:
Wrote the unique_copy simplification
Added:
   sandbox/committee/concepts/stdlib/unique_copy.tex (contents, props changed)
Removed:
   sandbox/committee/concepts/stdlib/clib-suppconcepts.tex
Text files modified:
   sandbox/committee/concepts/stdlib/Makefile | 3
   sandbox/committee/concepts/stdlib/clib-iterators.tex | 775 ----------------------------------------
   2 files changed, 2 insertions(+), 776 deletions(-)

Modified: sandbox/committee/concepts/stdlib/Makefile
==============================================================================
--- sandbox/committee/concepts/stdlib/Makefile (original)
+++ sandbox/committee/concepts/stdlib/Makefile 2008-08-21 00:32:01 EDT (Thu, 21 Aug 2008)
@@ -66,7 +66,8 @@
 # Default rule
 #
 NAMES = clib-intro clib-concepts clib-utilities clib-containers \
- clib-iterconcepts clib-iterators clib-algorithms clib-numerics
+ clib-iterconcepts clib-iterators clib-algorithms \
+ clib-numerics unique_copy
 
 OTHER_TEX = macros.tex
 

Modified: sandbox/committee/concepts/stdlib/clib-iterators.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-iterators.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-iterators.tex 2008-08-21 00:32:01 EDT (Thu, 21 Aug 2008)
@@ -1926,784 +1926,9 @@
 \end{itemdecl}
 
 \begin{itemdescr}
-\begin{itemdescr}
 \pnum
 \addedConcepts{\reallynote Declares that a \mbox{\tcode{move_iterator}} is a random access iterator if its underlying iterator is a random access iterator.}
 \end{itemdescr}
-\end{itemdescr}
-
-\rSec1[stream.iterators]{Stream iterators}
-
-\pnum
-To make it possible for algorithmic templates to work directly with input/output streams, appropriate
-iterator-like
-class templates
-are provided.
-
-\enterexample\
-\begin{codeblock}
-partial_sum_copy(istream_iterator<double, char>(cin),
- istream_iterator<double, char>(),
- ostream_iterator<double, char>(cout, "@\textbackslash_at_n"));
-\end{codeblock}
-
-reads a file containing floating point numbers from
-\tcode{cin},
-and prints the partial sums onto
-\tcode{cout}.
-\exitexample\
-
-\rSec2[istream.iterator]{Class template \tcode{istream_iterator}}
-
-\pnum
-\index{istream_iterator@\tcode{istream_iterator}}%
-\tcode{istream_iterator}
-reads (using
-\tcode{operator\shr})
-successive elements from the input stream for which it was constructed.
-After it is constructed, and every time
-\tcode{++}\
-is used, the iterator reads and stores a value of
-\tcode{T}.
-If the end of stream is reached (
-\tcode{operator void*()}\
-on the stream returns
-\tcode{false}),
-the iterator becomes equal to the
-\techterm{end-of-stream}\
-iterator value.
-The constructor with no arguments
-\tcode{istream_iterator()}\
-always constructs
-an end of stream input iterator object, which is the only legitimate iterator to be used for the end condition.
-The result of
-\tcode{operator*}\
-on an end of stream is not defined.
-For any other iterator value a
-\tcode{const T\&}\
-is returned.
-The result of
-\tcode{operator->}\
-on an end of stream is not defined.
-For any other iterator value a
-\tcode{const T*}\
-is returned.
-It is impossible to store things into istream iterators.
-The main peculiarity of the istream iterators
-is the fact that
-\tcode{++}\
-operators are not equality preserving, that is,
-\tcode{i == j}\
-does not guarantee at all that
-\tcode{++i == ++j}.
-Every time
-\tcode{++}\
-is used a new value is read.
-
-\pnum
-The practical consequence of this fact is that istream iterators can be used only for one-pass algorithms,
-which actually makes perfect sense, since for multi-pass algorithms it is always more appropriate to use
-in-memory data structures.
-
-\pnum
-Two end-of-stream iterators are always equal.
-An end-of-stream iterator is not
-equal to a non-end-of-stream iterator.
-Two non-end-of-stream iterators are equal when they are constructed from the same stream.
-
-\begin{codeblock}
-namespace std {
- template <class T, class charT = char, class traits = char_traits<charT>,
- class Distance = ptrdiff_t>
- class istream_iterator:
- public iterator<input_iterator_tag, T, Distance, const T*, const T&> {
- public:
- typedef charT char_type;
- typedef traits traits_type;
- typedef basic_istream<charT,traits> istream_type;
- istream_iterator();
- istream_iterator(istream_type& s);
- istream_iterator(const istream_iterator<T,charT,traits,Distance>& x);
- ~istream_iterator();
-
- const T& operator*() const;
- const T* operator->() const;
- istream_iterator<T,charT,traits,Distance>& operator++();
- istream_iterator<T,charT,traits,Distance> operator++(int);
- private:
- // \tcode{basic_istream<charT,traits>*} \techterm{in_stream}; \exposr
- // T \techterm{value}; \exposr
- };
-
- template <class T, class charT, class traits, class Distance>
- bool operator==(const istream_iterator<T,charT,traits,Distance>& x,
- const istream_iterator<T,charT,traits,Distance>& y);
- template <class T, class charT, class traits, class Distance>
- bool operator!=(const istream_iterator<T,charT,traits,Distance>& x,
- const istream_iterator<T,charT,traits,Distance>& y);
-}
-\end{codeblock}
-
-\rSec3[istream.iterator.cons]{\tcode{istream_iterator}\ constructors and destructor}
-
-\begin{itemdecl}
-istream_iterator();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Constructs the end-of-stream iterator.
-\end{itemdescr}
-
-\begin{itemdecl}
-istream_iterator(istream_type& @\farg{s}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Initializes \techterm{in_stream}\ with \farg{s}.
-\techterm{value}\ may be initialized during construction or the first time it is referenced.
-\end{itemdescr}
-
-\begin{itemdecl}
-istream_iterator(const istream_iterator<T,charT,traits,Distance>& x);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Constructs a copy of \farg{x}.
-\end{itemdescr}
-
-\begin{itemdecl}
-~istream_iterator();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-The iterator is destroyed.
-\end{itemdescr}
-
-\rSec3[istream.iterator.ops]{\tcode{istream_iterator}\ operations}
-
-\begin{itemdecl}
-const T& operator*() const;
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\techterm{value}.
-\end{itemdescr}
-
-\begin{itemdecl}
-const T* operator->() const;
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{\&(operator*())}.
-\end{itemdescr}
-
-\begin{itemdecl}
-istream_iterator<T,charT,traits,Distance>& operator++();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-\tcode{*\techterm{in_stream}\ \shr\ \techterm{value}}.
-
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\begin{itemdecl}
-istream_iterator<T,charT,traits,Distance> operator++(int);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-\begin{codeblock}
-istream_iterator<T,charT,traits,Distance> tmp = *this;
-*@\techterm{in_stream}@ >> @\techterm{value}@;
-return (tmp);
-\end{codeblock}
-\end{itemdescr}
-
-\begin{itemdecl}
-template <class T, class charT, class traits, class Distance>
- bool operator==(const istream_iterator<T,charT,traits,Distance> &@\farg{x}@,
- const istream_iterator<T,charT,traits,Distance> &@\farg{y}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{(\farg{x}.\techterm{in_stream}\ == \farg{y}.\techterm{in_stream})}.%
-\index{istream_iterator@\tcode{istream_iterator}!\tcode{operator==}}
-\end{itemdescr}
-
-\begin{itemdecl}
-template <class T, class charT, class traits, class Distance>
- bool operator!=(const istream_iterator<T,charT,traits,Distance> &@\farg{x}@,
- const istream_iterator<T,charT,traits,Distance> &@\farg{y}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{!(x == y)}\
-\index{istream_iterator@\tcode{istream_iterator}!\tcode{operator"!=}}
-\end{itemdescr}
-
-\rSec2[ostream.iterator]{Class template \tcode{ostream_iterator}}
-
-\pnum
-\index{ostream_iterator@\tcode{ostream_iterator}}%
-\tcode{ostream_iterator}
-writes (using
-\tcode{operator\shl})
-successive elements onto the output stream from which it was constructed.
-If it was constructed with
-\tcode{char*}
-as a constructor argument, this string, called a
-\techterm{delimiter string},
-is written to the stream after every
-\tcode{T}
-is written.
-It is not possible to get a value out of the output iterator.
-Its only use is as an output iterator in situations like
-
-\begin{codeblock}
-while (first != last)
- *result++ = *first++;
-\end{codeblock}
-
-\pnum
-\tcode{ostream_iterator}\
-is defined as:
-
-\begin{codeblock}
-namespace std {
- template <class T, class charT = char, class traits = char_traits<charT> >
- class ostream_iterator:
- public iterator<output_iterator_tag, void, void, void, void> {
- public:
- typedef charT char_type;
- typedef traits traits_type;
- typedef basic_ostream<charT,traits> ostream_type;
- ostream_iterator(ostream_type& s);
- ostream_iterator(ostream_type& s, const charT* delimiter);
- ostream_iterator(const ostream_iterator<T,charT,traits>& x);
- ~ostream_iterator();
- ostream_iterator<T,charT,traits>& operator=(const T& value);
-
- ostream_iterator<T,charT,traits>& operator*();
- ostream_iterator<T,charT,traits>& operator++();
- ostream_iterator<T,charT,traits>& operator++(int);
- private:
- // basic_ostream<charT,traits>* \techterm{out_stream}; \exposr
- // const charT* \techterm{delim}; \exposr
- };
-}
-\end{codeblock}
-
-\rSec3[ostream.iterator.cons.des]{\tcode{ostream_iterator}\ constructors and destructor}
-
-\begin{itemdecl}
-ostream_iterator(ostream_type& @\farg{s}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Initializes \techterm{out_stream}\ with \farg{s} and \techterm{delim}\ with null.
-\end{itemdescr}
-
-\begin{itemdecl}
-ostream_iterator(ostream_type& @\farg{s}@, const charT* @\farg{delimiter}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Initializes \techterm{out_stream}\ with \farg{s} and \techterm{delim}\ with \farg{delimiter}.
-\end{itemdescr}
-
-\begin{itemdecl}
-ostream_iterator(const ostream_iterator& @\farg{x}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Constructs a copy of \farg{x}.
-\end{itemdescr}
-
-\begin{itemdecl}
-~ostream_iterator();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-The iterator is destroyed.
-\end{itemdescr}
-
-\rSec3[ostream.iterator.ops]{\tcode{ostream_iterator}\ operations}
-
-\begin{itemdecl}
-ostream_iterator& operator=(const T& @\farg{value}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-\begin{codeblock}
-*@\techterm{out_stream}@ << @\farg{value}@;
-if(delim != 0)
- *@\techterm{out_stream}@ << @\techterm{delim}@;
-return (*this);
-\end{codeblock}
-\end{itemdescr}
-
-\begin{itemdecl}
-ostream_iterator& operator*();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\begin{itemdecl}
-ostream_iterator& operator++();
-ostream_iterator& operator++(int);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\rSec2[istreambuf.iterator]{Class template \tcode{istreambuf_iterator}}
-
-\index{istreambuf_iterator@\tcode{istreambuf_iterator}}%
-\begin{codeblock}
-namespace std {
- template<class charT, class traits = char_traits<charT> >
- class istreambuf_iterator
- : public iterator<input_iterator_tag, charT,
- typename traits::off_type, charT*, charT> {
- public:
- typedef charT char_type;
- typedef traits traits_type;
- typedef typename traits::int_type int_type;
- typedef basic_streambuf<charT,traits> streambuf_type;
- typedef basic_istream<charT,traits> istream_type;
-
- class @\techterm{proxy}@; @\exposrc@
-
- public:
- istreambuf_iterator() throw();
- istreambuf_iterator(istream_type& @\farg{s}@) throw();
- istreambuf_iterator(streambuf_type* @\farg{s}@) throw();
- istreambuf_iterator(const proxy& @\farg{p}@) throw();
- charT operator*() const;
- istreambuf_iterator<charT,traits>& operator++();
- proxy operator++(int);
- bool equal(istreambuf_iterator& @\farg{b}@) const;
- private:
- streambuf_type* @\techterm{sbuf_}@; @\exposrc@
- };
-
- template <class charT, class traits>
- bool operator==(const istreambuf_iterator<charT,traits>& @\farg{a}@,
- const istreambuf_iterator<charT,traits>& @\farg{b}@);
- template <class charT, class traits>
- bool operator!=(const istreambuf_iterator<charT,traits>& @\farg{a}@,
- const istreambuf_iterator<charT,traits>& @\farg{b}@);
-}
-\end{codeblock}
-
-\pnum
-The
-class template
-\tcode{istreambuf_iterator}\
-reads successive
-\textit{characters}\
-from the streambuf for which it was constructed.
-\tcode{operator*}\
-provides access to the current input character, if any.
-Each time
-\tcode{operator++}\
-is evaluated, the iterator advances to the next input character.
-If the end of stream is reached (streambuf_type::sgetc() returns
-\tcode{traits::eof()}),
-the iterator becomes equal to the
-\techterm{end of stream}\
-iterator value.
-The default constructor
-\tcode{istreambuf_iterator()}\
-and the constructor
-\tcode{istreambuf_iterator(0)}\
-both construct an end of stream iterator object suitable for use
-as an end-of-range.
-
-\pnum
-The result of
-\tcode{operator*()}\
-on an end of stream is undefined.
-\index{undefined behavior}%
-For any other iterator value a
-\tcode{char_type}\
-value is returned.
-It is impossible to assign a character via an input iterator.
-
-\pnum
-Note that in the input iterators,
-\tcode{++}\
-operators are not
-\techterm{equality preserving},
-that is,
-\tcode{i == j}\
-does not guarantee at all that
-\tcode{++i == ++j}.
-Every time
-\tcode{++}\
-is evaluated a new value is used.
-
-\pnum
-The practical consequence of this fact is that an
-\tcode{istreambuf_iterator}\
-object can be used only for
-\techterm{one-pass algorithms}.
-Two end of stream iterators are always equal.
-An end of stream iterator is not equal to a non-end of stream iterator.
-
-\rSec3[istreambuf.iterator::proxy]{Class template \tcode{istreambuf_iterator::proxy}}
-
-\index{proxy@\tcode{proxy}!\tcode{istreambuf_iterator}}%
-\begin{codeblock}
-namespace std {
- template <class charT, class traits = char_traits<charT> >
- class istreambuf_iterator<charT, traits>::proxy {
- charT @\techterm{keep_}@;
- basic_streambuf<charT,traits>* @\techterm{sbuf_}@;
- proxy(charT @\farg{c}@,
- basic_streambuf<charT,traits>* @\farg{sbuf}@);
- : @\techterm{keep_}@(@\farg{c}@), @\techterm{sbuf_}@(sbuf) { }
- public:
- charT operator*() { return @\techterm{keep_}@; }
- };
-}
-\end{codeblock}
-
-\pnum
-Class
-\tcode{istreambuf_iterator<charT,traits>::proxy}
-is for exposition only.
-An implementation is permitted to provide equivalent functionality without
-providing a class with this name.
-Class
-\tcode{istreambuf_iterator<charT, traits>\colcol{}proxy}\
-provides a temporary
-placeholder as the return value of the post-increment operator
-(\tcode{operator++}).
-It keeps the character pointed to by the previous value
-of the iterator for some possible future access to get the character.
-
-\rSec3[istreambuf.iterator.cons]{\tcode{istreambuf_iterator}\ constructors}
-
-\index{istreambuf_iterator@\tcode{istreambuf_iterator}!\tcode{istreambuf_iterator}}%
-\begin{itemdecl}
-istreambuf_iterator() throw();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Constructs the end-of-stream iterator.
-\end{itemdescr}
-
-\begin{itemdecl}
-istreambuf_iterator(basic_istream<charT,traits>& @\farg{s}@) throw();
-istreambuf_iterator(basic_streambuf<charT,traits>* @\farg{s}@) throw();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Constructs an
-\tcode{istreambuf_iterator<>}\
-that uses the
-\tcode{basic_streambuf<>}\
-object
-\tcode{*(\farg{s}.rdbuf())},
-or
-\tcode{*\farg{s}},
-respectively.
-Constructs an end-of-stream iterator if
-\tcode{\farg{s}.rdbuf()}\
-is null.
-\end{itemdescr}
-
-\begin{itemdecl}
-istreambuf_iterator(const proxy& @\farg{p}@) throw();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-Constructs a
-\tcode{istreambuf_iterator<>}\
-that uses the
-\tcode{basic_streambuf<>}\
-object pointed to by the
-\tcode{proxy}\
-object's constructor argument \farg{p}.
-\end{itemdescr}
-
-\rSec3[istreambuf.iterator::op*]{\tcode{istreambuf_iterator::operator*}}
-
-\index{operator*@\tcode{operator*}!\tcode{istreambuf_iterator}}%
-\begin{itemdecl}
-charT operator*() const
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-The character obtained via the
-\tcode{streambuf}\
-member
-\tcode{\techterm{sbuf_}->sgetc()}.
-\end{itemdescr}
-
-\rSec3[istreambuf.iterator::op++]{\tcode{istreambuf_iterator::operator++}}
-
-\index{operator++@\tcode{operator++}!\tcode{istreambuf_iterator}}%
-\begin{itemdecl}
-istreambuf_iterator<charT,traits>&
- istreambuf_iterator<charT,traits>::operator++();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-\tcode{\techterm{sbuf_}->sbumpc()}.
-
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\begin{itemdecl}
-proxy istreambuf_iterator<charT,traits>::operator++(int);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{proxy(\techterm{sbuf_}->sbumpc(), \techterm{sbuf_})}.
-\end{itemdescr}
-
-\rSec3[istreambuf.iterator::equal]{\tcode{istreambuf_iterator::equal}}
-
-\index{equal@\tcode{equal}!\tcode{istreambuf_iterator}}%
-\begin{itemdecl}
-bool equal(istreambuf_iterator<charT,traits>& @\farg{b}@) const;
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{true}\
-if and only if both iterators are at end-of-stream,
-or neither is at end-of-stream, regardless of what
-\tcode{streambuf}\
-object they use.
-\end{itemdescr}
-
-\rSec3[istreambuf.iterator::op==]{\tcode{operator==}}
-
-\index{operator==@\tcode{operator==}!\tcode{istreambuf_iterator}}%
-\begin{itemdecl}
-template <class charT, class traits>
- bool operator==(const istreambuf_iterator<charT,traits>& @\farg{a}@,
- const istreambuf_iterator<charT,traits>& @\farg{b}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{\farg{a}.equal(\farg{b})}.
-\end{itemdescr}
-
-\rSec3[istreambuf.iterator::op!=]{\tcode{operator!=}}
-
-\index{operator"!=@\tcode{operator"!=}!\tcode{istreambuf_iterator}}%
-\begin{itemdecl}
-template <class charT, class traits>
- bool operator!=(const istreambuf_iterator<charT,traits>& @\farg{a}@,
- const istreambuf_iterator<charT,traits>& @\farg{b}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{!\farg{a}.equal(\farg{b})}.
-\end{itemdescr}
-
-\rSec2[ostreambuf.iterator]{Class template \tcode{ostreambuf_iterator}}
-
-\index{ostreambuf_iterator@\tcode{ostreambuf_iterator}}%
-\begin{codeblock}
-namespace std {
- template <class charT, class traits = char_traits<charT> >
- class ostreambuf_iterator :
- public iterator<output_iterator_tag, void, void, void, void> {
- public:
- typedef charT char_type;
- typedef traits traits_type;
- typedef basic_streambuf<charT,traits> streambuf_type;
- typedef basic_ostream<charT,traits> ostream_type;
-
- public:
- ostreambuf_iterator(ostream_type& @\farg{s}@) throw();
- ostreambuf_iterator(streambuf_type* @\farg{s}@) throw();
- ostreambuf_iterator& operator=(charT @\farg{c}@);
-
- ostreambuf_iterator& operator*();
- ostreambuf_iterator& operator++();
- ostreambuf_iterator& operator++(int);
- bool failed() const throw();
-
- private:
- // streambuf_type* \techterm{sbuf_}; \exposr
- };
-}
-\end{codeblock}
-
-\pnum
-The
-class template
-\tcode{ostreambuf_iterator}\
-writes successive
-\textit{characters}\
-onto the output stream from which it was constructed.
-It is not possible to get a character value out of the output iterator.
-
-\rSec3[ostreambuf.iter.cons]{\tcode{ostreambuf_iterator}\ constructors}
-
-\index{ostreambuf_iterator@\tcode{ostreambuf_iterator}!\tcode{ostreambuf_iterator}}%
-\begin{itemdecl}
-ostreambuf_iterator(ostream_type& @\farg{s}@) throw();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\requires\
-\tcode{\farg{s}.rdbuf()}\
-shall not null pointer.
-\end{itemdescr}
-
-\begin{itemdescr}
-\pnum
-\effects\
-\tcode{\farg{:sbuf_}(\farg{s}.rdbuf()) \{\}}.
-\end{itemdescr}
-
-\begin{itemdecl}
-ostreambuf_iterator(streambuf_type* @\farg{s}@) throw();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\requires\
-\tcode{\farg{s}}\
-shall not be a null pointer.
-
-\pnum
-\effects\
-\tcode{: \techterm{sbuf_}(\farg{s}) \{\}}.
-\end{itemdescr}
-
-\rSec3[ostreambuf.iter.ops]{\tcode{ostreambuf_iterator}\ operations}
-
-\index{operator=@\tcode{operator=}!\tcode{ostreambuf_iterator}}%
-\begin{itemdecl}
-ostreambuf_iterator<charT,traits>&
- operator=(charT @\farg{c}@);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\effects\
-If
-\tcode{failed()}\
-yields
-\tcode{false},
-calls
-\tcode{\techterm{sbuf_}->sputc(\farg{c})};
-otherwise has no effect.
-
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\index{operator*@\tcode{operator*}!\tcode{ostreambuf_iterator}}%
-\begin{itemdecl}
-ostreambuf_iterator<charT,traits>& operator*();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\index{operator++@\tcode{operator++}!\tcode{ostreambuf_iterator}}%
-\begin{itemdecl}
-ostreambuf_iterator<charT,traits>& operator++();
-ostreambuf_iterator<charT,traits>& operator++(int);
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{*this}.
-\end{itemdescr}
-
-\index{failed@\tcode{failed}!\tcode{ostreambuf_iterator}}%
-\begin{itemdecl}
-bool failed() const throw();
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\returns\
-\tcode{true}
-if in any prior use of member
-\tcode{operator=},
-the call to
-\tcode{\techterm{sbuf_}->sputc()}\
-returned
-\tcode{traits::eof()};
-or
-\tcode{false}\
-otherwise.
-\end{itemdescr}
 
 \end{paras}
 

Deleted: sandbox/committee/concepts/stdlib/clib-suppconcepts.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-suppconcepts.tex 2008-08-21 00:32:01 EDT (Thu, 21 Aug 2008)
+++ (empty file)
@@ -1,134 +0,0 @@
-\documentclass[american,twoside]{book}
-\usepackage{refbib}
-\usepackage{pdfsync}
-\input{macros}
-
-%%--------------------------------------------------
-%% PDF
-
-\usepackage[pdftex,
- pdftitle={Supplemental Concepts for the C++0x Standard Library},
- pdfsubject={C++ International Standard Proposal},
- pdfcreator={Douglas Gregor},
- bookmarks=true,
- bookmarksnumbered=true,
- pdfpagelabels=true,
- pdfpagemode=UseOutlines,
- pdfstartview=FitH,
- linktocpage=true,
- colorlinks=true,
- linkcolor=blue,
- plainpages=false
- ]{hyperref}
-
-%%--------------------------------------------------
-%% Set section numbering limit, toc limit
-\setcounter{secnumdepth}{5}
-\setcounter{tocdepth}{1}
-
-%%--------------------------------------------------
-%% Parameters that govern document appearance
-\setlength{\oddsidemargin}{0pt}
-\setlength{\evensidemargin}{0pt}
-\setlength{\textwidth}{6.6in}
-
-%%--------------------------------------------------
-%% Handle special hyphenation rules
-\hyphenation{tem-plate ex-am-ple in-put-it-er-a-tor}
-
-% Do not put blank pages after chapters that end on odd-numbered pages.
-\def\cleardoublepage{\clearpage\if_at_twoside%
- \ifodd\c_at_page\else\hbox{}\thispagestyle{empty}\newpage%
- \if_at_twocolumn\hbox{}\newpage\fi\fi\fi}
-
-\newsavebox\rebindbox
-
-\begin{document}
-\raggedbottom
-
-\begin{titlepage}
-\begin{center}
-\huge
-Supplemental Concepts for the C++0x Standard Library
-\vspace{0.25in}
-\end{center}
-
-\normalsize
-\vspace{0.25in}
-\par\noindent Authors:
-\begin{tabular}[t]{l}
-Douglas Gregor, Indiana University \\
-Andrew Lumsdaine, Indiana University
-\end{tabular}\vspace{-6pt}
-
-\par\noindent Document number: DRAFT\vspace{-6pt}
-\par\noindent Date: \today\vspace{-6pt}
-\par\noindent Project: Programming Language \Cpp{}, Library Working Group\vspace{-6pt}
-\par\noindent Reply-to: Douglas Gregor $<$\href{mailto:dgregor_at_[hidden]}{dgregor_at_[hidden]}$>$\vspace{-6pt}
-
-\section*{Introduction}
-This document proposes supplemental concepts for the \Cpp0x Standard
-Library, which extend the foundational concepts in N2677. The concepts
-and changes herein are the result of LWG discussions and requests.
-
-Within the proposed wording, text that has been added
-\textcolor{addclr}{will be presented in blue} \addedConcepts{and
- underlined when possible}. Text that has been removed will be
-presented \textcolor{remclr}{in red},\removedConcepts{with
- strike-through when possible}.
-
-\editorial{Purely editorial comments will be written in a separate,
- shaded box.}
-
-\end{titlepage}
-
-%%--------------------------------------------------
-%% Headers and footers
-\pagestyle{fancy}
-\fancyhead[LE,RO]{\textbf{\rightmark}}
-\fancyhead[RE]{\textbf{\leftmark\hspace{1em}\thepage}}
-\fancyhead[LO]{\textbf{\thepage\hspace{1em}\leftmark}}
-\fancyfoot[C]{Draft}
-
-\fancypagestyle{plain}{
-\renewcommand{\headrulewidth}{0in}
-\fancyhead[LE,RO]{}
-\fancyhead[RE,LO]{}
-\fancyfoot{}
-}
-
-\renewcommand{\sectionmark}[1]{\markright{\thesection\hspace{1em}#1}}
-\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
-
-\setcounter{chapter}{19}
-\rSec0[utilities]{General utilities library}
-
-\rSec1[utility.concepts]{Concepts}
-
-\setcounter{section}{2}
-\editorial{Update [concept.support] as follows}
-\rSec2[concept.support]{Support concepts}
-\setcounter{Paras}{33}
-\begin{itemdecl}
-concept EnumerationType<typename T> : IntegralConstantExpressionType<T> {
- @\addedConcepts{typename underlying_type;}@
- @\addedConcepts{requires IntegralType<T>}@
- @\addedConcepts{\&\& IntegralLike<T>}@
- @\addedConcepts{\&\& ExplicitlyConvertible<T, underlying_type>}@
- @\addedConcepts{\&\& ExplicitlyConvertible<underlying_type, T>;}@
-}
-\end{itemdecl}
-
-\begin{itemdescr}
-\pnum
-\mbox{\reallynote} describes enumeration types
-([dcl.enum]). \addedConcepts{\mbox{\tcode{underlying_type}} is the underlying type (\mbox{\ref{dcl.enum}}) of the enumeration type \mbox{\tcode{T}}.}
-
-\pnum
-\mbox{\requires}
-for every type \mbox{\tcode{T}} that is an enumeration type, a concept map
-\mbox{\tcode{EnumerationType<T>}} shall be implicitly defined in namespace
-\mbox{\tcode{std}}.
-\end{itemdescr}
-
-\end{document}

Added: sandbox/committee/concepts/stdlib/unique_copy.tex
==============================================================================
--- (empty file)
+++ sandbox/committee/concepts/stdlib/unique_copy.tex 2008-08-21 00:32:01 EDT (Thu, 21 Aug 2008)
@@ -0,0 +1,393 @@
+\documentclass[american]{article}
+\usepackage{hyperref}
+\usepackage{amsmath}
+\usepackage{graphicx}
+\usepackage{listings}
+\usepackage{cite}
+\usepackage{color}
+\usepackage{soul}
+\usepackage{babel} % needed for iso dates
+\usepackage[iso]{isodate} % use iso format for dates
+
+\topmargin 0pt
+\advance \topmargin by -\headheight
+\advance \topmargin by -\headsep
+
+\textheight 8.9in
+
+\oddsidemargin 0pt
+\evensidemargin \oddsidemargin
+\marginparwidth 0.5in
+
+\textwidth 6.5in
+
+\definecolor{addclr}{rgb}{0,.6,.6}
+\definecolor{remclr}{rgb}{1,0,0}
+\newcommand{\added}[1]{\textcolor{addclr}{\ul{#1}}}
+\newcommand{\removed}[1]{\textcolor{remclr}{\st{#1}}}
+\newcommand{\changed}[2]{\removed{#1}\added{#2}}
+
+\newcommand{\code}[1]{\lstinline[basicstyle=\sffamily,keywords={}]{#1}}
+\newcommand{\func}[1]{\lstinline[basicstyle=\sffamily,keywords={}]{#1()}}
+\newcommand{\concept}[1]{{\small \textsf{#1}}}
+\newcommand{\keyword}[1]{\code{#1}}
+
+% Colors we need
+\definecolor{gray}{rgb}{.8,.8,.8}
+\definecolor{white}{rgb}{1.0,1.0,1.0}
+
+% \grammarbox should be used to illustrate the grammar of variadic
+% templates
+\newcommand{\grammarbox}[1]{\fcolorbox{black}{gray}{#1}}
+
+\newcommand{\Cpp}{C\kern-0.05em\texttt{+\kern-0.03em+}}
+
+% The default style for lstlisting, which highlights the concept
+% keywords along with all of the other C++ keywords. We also make
+% anything between ~'s white.
+\lstdefinestyle{c++}{showstringspaces=false,columns=fullflexible,language=C++,
+escapechar=@,xleftmargin=1pc,%
+%basicstyle=\small\bfseries\itshape,%
+%keywordstyle=\underbar,
+basicstyle=\small\sffamily,
+commentstyle=\mdseries,
+moredelim=**[is][\color{white}]{~}{~},
+literate={->}{{$\rightarrow\;$}}1 {<-}{{$\leftarrow\;$}}1 {=>}{{$\Rightarrow\;$}
+}1,
+literate={-}{{\text{-}}}1
+}
+\lstset{style=c++}
+
+\lstdefinestyle{c++tilde}{showstringspaces=false,columns=fullflexible,language=C++,
+escapechar=@,xleftmargin=1pc,%
+%basicstyle=\small\bfseries\itshape,%
+%keywordstyle=\underbar,
+basicstyle=\small\sffamily,
+commentstyle=\mdseries,
+literate={->}{{$\rightarrow\;$}}1 {<-}{{$\leftarrow\;$}}1 {=>}{{$\Rightarrow\;$}
+}1,
+literate={-}{{\text{-}}}1
+}
+
+% Used in code samples to create a half a line space.
+\newcommand{\halfline}{\vspace{-1.75ex}}
+
+% Lame attempt at macro-compatibility with Pete's LaTeX
+\newcommand{\tcode}[1]{\code{#1}}
+\newcommand{\enternote}{[~\emph{Note}: }
+\newcommand{\exitnote}{-- \emph{end note}~]}
+\newcommand{\enterexample}{[~\emph{Example}: }
+\newcommand{\exitexample}{-- \emph{end example}~]}
+\newcommand{\techterm}[1]{\emph{#1}}
+
+% Borrowed from Pete's LaTeX for the standard
+\newcounter{Paras}
+\makeatletter
+\@addtoreset{Paras}{chapter}
+\@addtoreset{Paras}{section}
+\@addtoreset{Paras}{subsection}
+\@addtoreset{Paras}{subsubsection}
+\@addtoreset{Paras}{paragraph}
+\@addtoreset{Paras}{subparagraph}
+\def\pnum{\addtocounter{Paras}{1}\noindent\llap{{\footnotesize\arabic{Paras}}\hspace{\@totalleftmargin}\quad}}
+\makeatother
+
+% Also Pete's...
+% Our usual abbreviation for 'listings'. Comments are in
+% italics. Arbitrary TeX commands can be used if they're
+% surrounded by @ signs.
+\lstnewenvironment{codeblock}
+{
+ \lstset{escapechar=@}
+}
+{
+}
+
+% Permit use of '@' inside codeblock blocks (don't ask)
+\makeatletter
+\newcommand{\atsign}{@}
+\makeatother
+
+%%--------------------------------------------------
+%% Bnf environments
+\newlength{\BnfIndent}
+\setlength{\BnfIndent}{\leftmargini}
+\newlength{\BnfInc}
+\setlength{\BnfInc}{\BnfIndent}
+\newlength{\BnfRest}
+\setlength{\BnfRest}{2\BnfIndent}
+\newcommand{\BnfNontermshape}{\rmfamily\itshape\small}
+\newcommand{\BnfTermshape}{\ttfamily\upshape\small}
+\newcommand{\nonterminal}[1]{{\BnfNontermshape #1}}
+
+\newenvironment{bnfbase}
+ {
+ \newcommand{\terminal}[1]{{\BnfTermshape ##1}}
+ \newcommand{\descr}[1]{\normalfont{##1}}
+ \newcommand{\bnfindentfirst}{\BnfIndent}
+ \newcommand{\bnfindentinc}{\BnfInc}
+ \newcommand{\bnfindentrest}{\BnfRest}
+ \begin{minipage}{.9\hsize}
+ \newcommand{\br}{\hfill\\}
+ }
+ {
+ \end{minipage}
+ }
+
+\newenvironment{BnfTabBase}[1]
+{
+ \begin{bnfbase}
+ #1
+ \begin{indented}
+ \begin{tabbing}
+ \hspace*{\bnfindentfirst}\=\hspace{\bnfindentinc}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\kill%
+}
+{
+ \end{tabbing}
+ \end{indented}
+ \end{bnfbase}
+}
+
+\newenvironment{bnfkeywordtab}
+{
+ \begin{BnfTabBase}{\BnfTermshape}
+}
+{
+ \end{BnfTabBase}
+}
+
+\newenvironment{bnftab}
+{
+ \begin{BnfTabBase}{\BnfNontermshape}
+}
+{
+ \end{BnfTabBase}
+}
+
+\newenvironment{simplebnf}
+{
+ \begin{bnfbase}
+ \BnfNontermshape
+ \begin{indented}
+}
+{
+ \end{indented}
+ \end{bnfbase}
+}
+
+\newenvironment{bnf}
+{
+ \begin{bnfbase}
+ \list{}
+ {
+ \setlength{\leftmargin}{\bnfindentrest}
+ \setlength{\listparindent}{-\bnfindentinc}
+ \setlength{\itemindent}{\listparindent}
+ }
+ \BnfNontermshape
+ \item\relax
+}
+{
+ \endlist
+ \end{bnfbase}
+}
+
+% non-copied versions of bnf environments
+\newenvironment{ncbnftab}
+{
+ \begin{bnftab}
+}
+{
+ \end{bnftab}
+}
+
+\newenvironment{ncsimplebnf}
+{
+ \begin{simplebnf}
+}
+{
+ \end{simplebnf}
+}
+
+\newenvironment{ncbnf}
+{
+ \begin{bnf}
+}
+{
+ \end{bnf}
+}
+
+\begin{document}
+
+\markboth{Doc. no: N2742=08-0252}{Doc. no: N2742=08-0252}
+\pagestyle{myheadings}
+
+\title{Simplifying \tcode{unique_copy}}
+\author{}
+
+\date{}
+\maketitle
+\vspace{-0.5in}
+\par\noindent Author: Douglas Gregor, Indiana University
+\par\noindent Document number: N2742=08-0252
+\par\noindent Date: \today
+\par\noindent Project: Programming Language C++, Library Working Group
+\par\noindent Reply-to: Douglas Gregor $<$\href{mailto:dgregor_at_[hidden]}{dgregor_at_[hidden]}$>$
+
+\section{Introduction}
+This proposal simplifies \tcode{unique_copy}, by removing a mandated
+optimization (in the form of iterator-category---dependent requirements)
+in favor of a more direct specification, while retaining implementor's
+freedom to optimize these cases.
+
+\subsection{The Problem}
+The \tcode{unique_copy} algorithm has by far the most complicated
+concepts specification of any algorithm, to the point of being
+embarrassing. The fundamental problem is
+the following requirement in [alg.unique]p5:
+
+\begin{quote}
+ If neither InputIterator nor OutputIterator meets the requirements
+ of forward iterator then the value type of InputIterator shall be
+ CopyConstructible (34) and CopyAssignable (table 36). Otherwise
+ CopyConstructible is not required.
+\end{quote}
+
+This requirement actually mandates three different implementations of
+\tcode{unique_copy}: one for (input, output), one for (forward,
+output), and one for (input, forward). With the
+predicate/\tcode{operator==} distinction, we end up with six
+implementations hidden behind the two \tcode{unique_copy} signatures
+shown in the specification. With concepts, however, we need to show
+each signature because the requirements differ from one signature to
+another, leading to the current concepts specification:
+
+\begin{lstlisting}
+template<InputIterator InIter, typename OutIter>
+ requires OutputIterator<OutIter, InIter::reference>
+ && OutputIterator<OutIter, const InIter::value_type&>
+ && EqualityComparable<InIter::value_type>
+ && CopyAssignable<InIter::value_type>
+ && CopyConstructible<InIter::value_type>
+ && !ForwardIterator<InIter>
+ && !ForwardIterator<OutIter>
+ OutIter unique_copy(InIter first, InIter last, OutIter result);
+template<ForwardIterator InIter, OutputIterator<auto, InIter::reference> OutIter>
+ requires EqualityComparable<InIter::value_type>
+ OutIter unique_copy(InIter first, InIter last, OutIter result);
+template<InputIterator InIter, ForwardIterator OutIter>
+ requires OutputIterator<OutIter, InIter::reference>
+ && HasEqualTo<OutIter::value_type, InIter::value_type>
+ && !ForwardIterator<InIter>
+ OutIter unique_copy(InIter first, InIter last, OutIter result);
+template<InputIterator InIter, typename OutIter,
+ EquivalenceRelation<auto, InIter::value_type> Pred>
+ requires OutputIterator<OutIter, InIter::reference>
+ && OutputIterator<OutIter, const InIter::value_type&>
+ && CopyAssignable<InIter::value_type>
+ && CopyConstructible<InIter::value_type>
+ && CopyConstructible<Pred>
+ && !ForwardIterator<InIter>
+ && !ForwardIterator<OutIter>
+ OutIter unique_copy(InIter first, InIter last, OutIter result, Pred pred);
+template<ForwardIterator InIter, OutputIterator<auto, InIter::reference> OutIter,
+ EquivalenceRelation<auto, InIter::value_type> Pred>
+ requires CopyConstructible<Pred>
+ OutIter unique_copy(InIter first, InIter last, OutIter result, Pred pred);
+template<InputIterator InIter, ForwardIterator OutIter,
+ Predicate<auto, OutIter::value_type, InIter::value_type> Pred>
+ requires OutputIterator<OutIter, InIter::reference>
+ && CopyConstructible<Pred>
+ && !ForwardIterator<InIter>
+ OutIter unique_copy(InIter first, InIter last, OutIter result, Pred pred);
+\end{lstlisting}
+
+The concept requirements specified here state the actual operations
+needed to implement the various forms of the \tcode{unique_copy}
+algorithm. The negative requirements are needed to direct overload
+resolution, since there is no natural ordering among these overloads.
+
+\subsection{A Brief History}
+In \Cpp98, the \tcode{unique_copy} algorithm was underspecified (it
+did not mention \tcode{CopyAssignable} or \tcode{CopyConstructible}),
+but the common practice was to provide all six implementations. The
+resolution to DR 241 introduced the language that mandated six
+implementations.
+
+\subsection{The Solution}
+This proposal eliminates the requirement for the
+\tcode{ForwardIterator} variants of this algorithm. Instead, the
+algorithm requires \tcode{CopyConstructible} and
+\tcode{CopyAssignable} value types (always). Implementers are, of
+course, free to add more-specialized overloads that optimize away the
+copy assignment and copy constructions when a forward iterator is
+available.
+
+\subsection{Move-Only Types}
+The side effect of the simpler specification is that it no longer
+permits the use of move-only types in \tcode{unique_copy}, since
+\tcode{unique_copy} always requires \tcode{CopyConstructible} and
+\tcode{CopyAssignable}. I believe this is a reasonable trade-off for
+several reasons:
+
+\begin{enumerate}
+\item Minimizing specification complexity is extremely important,
+ especially with the introduction of concepts. Users will look to the
+ standard for advice on how to use concepts, and we do not want them
+ following the lead of \tcode{unique_copy} as it is currently
+ written.
+\item It's not a backward-compatibility problem: we didn't have
+ move-only types in \Cpp98, so no conforming \Cpp98 or \Cpp03 code
+ will be broken by this change.
+\item \tcode{unique_copy} doesn't make sense for move-only types. The
+ algorithm requires \tcode{EqualityComparable}, which itself implies
+ that you can have multiple copies of a single value. Move-only
+ types, on the other hand, generally represent handles to resources
+ that are uniquely held, and hence will not have particularly
+ meaningful \tcode{operator==}. The prototypical example of a
+ move-only type, \tcode{unique_ptr}, has an \tcode{operator==} that
+ is only true when both pointers are NULL. Thus, \tcode{unique_copy}
+ on \tcode{unique_ptr}s merely removes duplicate NULL pointers: this
+ isn't a strong case when weighed against the specification complexity.
+\end{enumerate}
+
+\section{Proposed Resolution}
+In the concepts-based standard library, replace the six overloads of
+\tcode{unique_copy} with the following two signatures:
+
+\begin{lstlisting}
+template<InputIterator InIter, typename OutIter>
+ requires OutputIterator<OutIter, InIter::reference>
+ && OutputIterator<OutIter, const InIter::value_type&>
+ && EqualityComparable<InIter::value_type>
+ && CopyAssignable<InIter::value_type>
+ && CopyConstructible<InIter::value_type>
+ OutIter unique_copy(InIter first, InIter last, OutIter result);
+template<InputIterator InIter, typename OutIter,
+ EquivalenceRelation<auto, InIter::value_type> Pred>
+ requires OutputIterator<OutIter, InIter::reference>
+ && OutputIterator<OutIter, const InIter::value_type&>
+ && CopyAssignable<InIter::value_type>
+ && CopyConstructible<InIter::value_type>
+ && CopyConstructible<Pred>
+ OutIter unique_copy(InIter first, InIter last, OutIter result, Pred pred);
+\end{lstlisting}
+
+\noindent
+In the pre-concepts standard library, modify [alg.unique]p5 as
+follows:
+
+\begin{quote}
+\textit{Requires}: The ranges \tcode{[first,last)} and \tcode{[result,result+(last-first))} shall not overlap. The expression
+\tcode{*result = *first} shall be valid. \changed{If neither \mbox{\tcode{InputIterator}} nor \mbox{\tcode{OutputIterator}} meets the requirements
+of forward iterator then the}{The} value type of \tcode{InputIterator} shall be \tcode{CopyConstructible} (34) and \tcode{CopyAssignable}
+(table 36). \removed{Otherwise \mbox{\tcode{CopyConstructible}} is not required.}
+\end{quote}
+
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk