|
Boost-Commit : |
From: dgregor_at_[hidden]
Date: 2008-08-16 11:48:12
Author: dgregor
Date: 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
New Revision: 48174
URL: http://svn.boost.org/trac/boost/changeset/48174
Log:
Finish the first round of updates, including all changes to the iterators chapter discussed at the drafting meeting
Text files modified:
sandbox/committee/concepts/stdlib/clib-algorithms.tex | 19 +++----
sandbox/committee/concepts/stdlib/clib-concepts.tex | 50 +++++++++++++++++++
sandbox/committee/concepts/stdlib/clib-containers.tex | 57 ++++++++++++++--------
sandbox/committee/concepts/stdlib/clib-iterators.tex | 99 +++++++++++++++++++++++++++++++--------
sandbox/committee/concepts/stdlib/clib-suppconcepts.tex | 34 -------------
sandbox/committee/concepts/stdlib/clib-utilities.tex | 55 ++++++++++-----------
sandbox/committee/concepts/stdlib/macros.tex | 2
7 files changed, 201 insertions(+), 115 deletions(-)
Modified: sandbox/committee/concepts/stdlib/clib-algorithms.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-algorithms.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-algorithms.tex 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -75,6 +75,9 @@
\section*{Changes from N2696}
\begin{itemize}
\item Fixed requirements for \tcode{partial_sort_copy}.
+\item Replaced uses of the \tcode{HasStdMove} concept with uses of
+ \tcode{RvalueOf}, and reverted back to using \tcode{std::move} (that
+ than \tcode{std_move}) for semantic descriptions.
\end{itemize}
\end{titlepage}
@@ -228,13 +231,11 @@
@\textcolor{black}{// \ref{alg.move}, move:}@
template<InputIterator InIter, typename OutIter>
- requires HasStdMove<InIter::reference>
- && OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>
+ requires OutputIterator<OutIter, RvalueOf<InIter::reference>::type>
OutIter move(InIter @\farg{first}@, InIter @\farg{last}@,
OutIter @\farg{result}@);
template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
- requires HasStdMove<InIter::reference>
- && OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>
+ requires OutputIterator<OutIter, RvalueOf<InIter::reference>::type>
OutIter move_backward(InIter @\farg{first}@, InIter @\farg{last}@,
OutIter @\farg{result}@);
@@ -1553,8 +1554,7 @@
\color{addclr}
\begin{itemdecl}
template<InputIterator InIter, typename OutIter>
- requires HasStdMove<InIter::reference>
- && OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>
+ requires OutputIterator<OutIter, RvalueOf<InIter::reference>::type>
OutIter move(InIter first, InIter last,
OutIter result);
\end{itemdecl}
@@ -1569,7 +1569,7 @@
For each non-negative integer
\mbox{\tcode{n < (\farg{last}-\farg{first})}},
performs
-\mbox{\tcode{*(\farg{result}\ + n)}} \mbox{\tcode{=}} \mbox{\tcode{std_move}}} \addedD{\mbox{\tcode{(*(\farg{first}\ + n))}}.}
+\mbox{\tcode{*(\farg{result}\ + n)}} \mbox{\tcode{=}} \mbox{\tcode{std::move}}} \addedD{\mbox{\tcode{(*(\farg{first}\ + n))}}.}
\pnum
\addedD{\mbox{\returns}
@@ -1592,8 +1592,7 @@
\color{addclr}
\begin{itemdecl}
template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
- requires HasStdMove<InIter::reference>
- && OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>
+ requires OutputIterator<OutIter, RvalueOf<InIter::reference>::type>
OutIter move_backward(InIter first, InIter last,
OutIter result);
\end{itemdecl}
@@ -1618,7 +1617,7 @@
\addedD{For each positive integer
\mbox{\tcode{n <= (\farg{last}\ - \farg{first})}},
performs
-\mbox{\tcode{*(\farg{result}\ - n) =}} \mbox{\tcode{std_move}}\mbox{\tcode{(*(\farg{last}\ - n))}}.}
+\mbox{\tcode{*(\farg{result}\ - n) =}} \mbox{\tcode{std::move}}\mbox{\tcode{(*(\farg{last}\ - n))}}.}
\pnum
\addedD{\mbox{\requires}
Modified: sandbox/committee/concepts/stdlib/clib-concepts.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-concepts.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-concepts.tex 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -105,6 +105,16 @@
addition of the new \tcode{Constructible} concept that implies some
semantics by refining \tcode{NothrowDestructible}, and will be used
throughout most of the standard library.
+
+\item Added the \tcode{RvalueOf} concept, which is needed to constrain
+ and use \tcode{std::move} within the standard library. This concept
+ replaces the \tcode{HasStdMove} concept that was part of the
+ iterator concepts proposal.
+
+\item In \tcode{MoveConstructible} and \tcode{MoveAssignable}, added a
+ constructor and copy-assignment operator requirement, respectively,
+ that accept an \tcode{RvalueOf<T>::type} on the right-hand side, to
+ account for uses of \tcode{std::move}.
\end{itemize}
\end{titlepage}
@@ -183,6 +193,10 @@
concept SameType<typename T, typename U> { }
concept DerivedFrom<typename Derived, typename Base> { }
+ // \ref{concept.rvalue}, rvalue:
+ auto concept RvalueOf<typename T> @\textit{see below}@;
+ template<typename T> concept_map RvalueOf<T&> @\textit{see below}@;
+
// \ref{concept.true}, true:
concept True<bool> { }
concept_map True<true> { }
@@ -592,6 +606,34 @@
\mbox{\tcode{std}}.
\end{itemdescr}
+\rSec2[concept.rvalue]{Rvalue}
+\begin{itemdecl}
+auto concept RvalueOf<typename T> {
+ typename type = T&&;
+ requires Convertible<T&, type> && Convertible<T&&, type>;
+}
+\end{itemdecl}
+
+\begin{itemdescr}
+\pnum
+\addedConcepts{\mbox{\reallynote} describes the rvalue reference type
+ for an arbitrary type \mbox{\tcode{T}}.}
+\end{itemdescr}
+
+\begin{itemdecl}
+template<typename T> concept_map RvalueOf<T&> {
+ typedef T&& type;
+}
+\end{itemdecl}
+
+\begin{itemdescr}
+\pnum
+\addedConcepts{\mbox{\reallynote} provides the appropriate rvalue
+ reference type for the rvalue an lvalue reference type. \enternote this
+ concept map is required to circumvent reference collapsing for
+ lvalue references. \exitnote}
+\end{itemdescr}
+
\rSec2[concept.true]{True}
\begin{itemdecl}
@@ -1334,7 +1376,9 @@
\rSec2[concept.copymove]{Copy and move}
\begin{itemdecl}
-auto concept MoveConstructible<typename T> : Constructible<T, T&&> { }
+auto concept MoveConstructible<typename T> : Constructible<T, T&&> {
+ requires RvalueOf<T> && Constructible<T, RvalueOf<T>::type>;
+}
\end{itemdecl}
\begin{itemdescr}
@@ -1389,7 +1433,9 @@
\end{itemdescr}
\begin{itemdecl}
-auto concept MoveAssignable<typename T> : HasAssign<T, T&&> { }
+auto concept MoveAssignable<typename T> : HasAssign<T, T&&> {
+ requires RvalueOf<T> && HasAssign<T, RvalueOf<T>::type>;
+}
\end{itemdecl}
\begin{itemdescr}
Modified: sandbox/committee/concepts/stdlib/clib-containers.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-containers.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-containers.tex 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -52,7 +52,7 @@
\begin{center}
\huge
Concepts for the C++0x Standard Library: Containers\\
-(Revision 2)
+(Revision 3)
\end{center}
\normalsize
@@ -64,14 +64,25 @@
Mat Marcus, Adobe Systems, Inc.\\
Pablo Halpern, Bloomberg, L.P.
\end{tabular}\vspace{-6pt}
-\par\noindent Document number: N2694=08-0204\vspace{-6pt}
-\par\noindent Revises document number: N2623=08-0133\vspace{-6pt}
+\par\noindent Document number: DRAFT\vspace{-6pt}
+\par\noindent Revises document number: N2694=08-0204\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}
\libintrotext{Chapter 23}
+
+\section*{Changes from N2694}
+\begin{itemize}
+\item Added the \tcode{NothrowDestructible<Cont>} requirement to each
+ of the container adaptors (\tcode{queue}, \tcode{priority_queue},
+ \tcode{stack}).
+\item Changed all of the \tcode{HasConstructible} requirements to
+ \tcode{Constructible} requirements, since we always need a no-throw
+ destructor.
+\end{itemize}
+
\end{titlepage}
%%--------------------------------------------------
@@ -1362,6 +1373,7 @@
template <@\changedConcepts{class}{ObjectType}@ T, class Cont@\removedConcepts{ainer}@ = deque<T> >
@\addedConcepts{requires FrontInsertionSequence<Cont> \&\& BackInsertionSequence<Cont>}@
@\addedConcepts{ \&\& SameType<T, Cont::value_type>}@
+ @\addedConcepts{\&\& NothrowDestructible<Cont>}@
class queue;
template <class T, @\changedConcepts{class}{EqualityComparable}@ Cont@\removedConcepts{ainer}@>
bool operator==(const queue<T, Cont@\removedConcepts{ainer}@>& x,const queue<T, Cont@\removedConcepts{ainer}@>& y);
@@ -1386,6 +1398,7 @@
@\removedCC{{class}}\changedCCC{Predicate<auto, T, T>}{StrictWeakOrder<auto, T>}@ Compare = less<typename Cont@\removedConcepts{ainer}@::value_type> >
@\addedConcepts{requires SameType<Cont::value_type, T> \&\&} \removedCCC{Mutable}\addedConcepts{RandomAccessIterator<Cont::iterator>}@
@\addedConcepts{\&\& }\changedCCC{Swappable}{Shuffle}\addedConcepts{Iterator<Cont::iterator> \&\& CopyConstructible<Compare>}@
+ @\addedConcepts{\&\& NothrowDestructible<Cont>}@
class priority_queue;
template <@\changedConcepts{class}{ObjectType}@ T, @\changedCCC{class Allocator}{Swappable Cont}@@\addedConcepts{, Swappable Compare}@>
void swap(priority_queue<T,@\changedCCC{Allocator}{ Cont, Compare}@>& x, priority_queue<T,@\changedCCC{Allocator}{ Cont, Compare}@>& y);
@@ -1403,6 +1416,7 @@
namespace std {
template <@\changedConcepts{class}{ObjectType}@ T, @\changedConcepts{class}{BackInsertionSequence}@ Cont@\removedConcepts{ainer}@ = deque<T> >
@\addedConcepts{requires SameType<Cont::value_type, T>}@
+ @\addedConcepts{\&\& NothrowDestructible<Cont>}@
class stack;
template <class T, @\changedCCC{class}{EqualityComparable}@ Cont@\removedConcepts{ainer}@>
bool operator==(const stack<T, Cont@\removedConcepts{ainer}@>& x,const stack<T, Cont@\removedConcepts{ainer}@>& y);
@@ -3424,6 +3438,7 @@
template <@\changedConcepts{class}{ObjectType}@ T, class Cont@\removedConcepts{ainer}@ = deque<T> >
@\addedConcepts{requires FrontInsertionSequence<Cont> \&\& BackInsertionSequence<Cont>}@
@\addedConcepts{\&\& SameType<T, Cont::value_type>}@
+ @\addedConcepts{\&\& NothrowDestructible<Cont>}@
class queue {
public:
typedef typename Cont@\removedConcepts{ainer}@::value_type value_type;
@@ -3439,16 +3454,16 @@
@\addedConcepts{requires MoveConstructible<Cont>}@ explicit queue(Cont@\removedConcepts{ainer}@&& = Cont@\removedConcepts{ainer}@());
@\addedConcepts{requires MoveConstructible<Cont>}@ queue(queue&& q) : c(std::move(q.c)) {}
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Alloc>}@
explicit queue(const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Cont, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Cont, Alloc>}@
queue(const Cont@\removedConcepts{ainer}@&, const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Cont\&\&, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Cont\&\&, Alloc>}@
queue(Cont@\removedConcepts{ainer}@&&, const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Cont\&\&, Alloc\&\&>}@
+ @\addedConcepts{requires Constructible<Cont, Cont\&\&, Alloc\&\&>}@
queue(queue&&, const Alloc&);
@\addedConcepts{requires MoveAssignable<Cont>}@ queue& operator=(queue&& q)
{ c = std::move(q.c); return *this; }
@@ -3628,6 +3643,7 @@
@\removedCC{class}\changedCCC{Predicate<auto, T, T>}{StrictWeakOrder<auto, T>}@ Compare = less<typename Cont@\removedConcepts{ainer}@::value_type> >
@\addedConcepts{requires SameType<Cont::value_type, T> \&\&} \removedCCC{Mutable}\addedConcepts{RandomAccessIterator<Cont::iterator>}@
@\addedConcepts{\&\&} \changedCCC{Swappable}{Shuffle}\addedConcepts{Iterator<Cont::iterator> \&\& CopyConstructible<Compare>}@
+ @\addedConcepts{\&\& NothrowDestructible<Cont>}@
class priority_queue {
public:
typedef typename Cont@\removedConcepts{ainer}@::value_type value_type;
@@ -3644,29 +3660,29 @@
@\addedConcepts{requires MoveConstructible<Cont>}@
explicit priority_queue(const Compare& x = Compare(), Cont@\removedConcepts{ainer}@&& = Cont@\removedConcepts{ainer}@());
template <@\changedConcepts{class InputIterator}{InputIterator Iter}@>
- @\addedConcepts{CopyConstructible<Cont> \&\& HasConstructor<Cont, Iter, Iter>}@
+ @\addedConcepts{CopyConstructible<Cont> \&\& Constructible<Cont, Iter, Iter>}@
priority_queue(@\changedConcepts{InputIterator}{Iter}@ first, @\changedConcepts{InputIterator}{Iter}@ last,
const Compare& x, const Cont@\removedConcepts{ainer}@&);
template <@\changedConcepts{class InputIterator}{InputIterator Iter}@>
- @\addedConcepts{MoveConstructible<Cont> \&\& HasConstructor<Cont, Iter, Iter>}@
+ @\addedConcepts{MoveConstructible<Cont> \&\& Constructible<Cont, Iter, Iter>}@
priority_queue(@\changedConcepts{InputIterator}{Iter}@ first, @\changedConcepts{InputIterator}{Iter}@ last,
const Compare& x = Compare(), Cont@\removedConcepts{ainer}@&& = Cont@\removedConcepts{ainer}@());
@\addedConcepts{requires MoveConstructible<Cont>}@ priority_queue(priority_queue&&);
@\addedConcepts{requires MoveAssignable<Cont>}@ priority_queue& operator=(priority_queue&&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Alloc>}@
explicit priority_queue(const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Alloc>}@
priority_queue(const Compare&, const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Cont, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Cont, Alloc>}@
priority_queue(const Compare&, const Cont@\removedConcepts{ainer}@&, const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Cont\&\&, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Cont\&\&, Alloc>}@
priority_queue(const Compare&, Cont@\removedConcepts{ainer}@&&, const Alloc&);
template <class Alloc>
- @\addedConcepts{requires HasConstructor<Cont, Cont\&\&, Alloc>}@
+ @\addedConcepts{requires Constructible<Cont, Cont\&\&, Alloc>}@
priority_queue(priority_queue&&, const Alloc&);
bool empty() const { return @\removedCCC{c.}@empty(@\addedCC{c}@); }
@@ -3729,11 +3745,11 @@
\begin{itemdecl}
template <@\changedConcepts{class InputIterator}{InputIterator Iter}@>
- @\addedConcepts{CopyConstructible<Cont> \&\& HasConstructor<Cont, Iter, Iter>}@
+ @\addedConcepts{CopyConstructible<Cont> \&\& Constructible<Cont, Iter, Iter>}@
priority_queue(@\changedConcepts{InputIterator}{Iter}@ first, @\changedConcepts{InputIterator}{Iter}@ last,
const Compare& x, const Cont@\removedConcepts{ainer}@&);
template <@\changedConcepts{class InputIterator}{InputIterator Iter}@>
- @\addedConcepts{MoveConstructible<Cont> \&\& HasConstructor<Cont, Iter, Iter>}@
+ @\addedConcepts{MoveConstructible<Cont> \&\& Constructible<Cont, Iter, Iter>}@
priority_queue(@\changedConcepts{InputIterator}{Iter}@ first, @\changedConcepts{InputIterator}{Iter}@ last,
const Compare& x = Compare(), Cont@\removedConcepts{ainer}@&& = Cont@\removedConcepts{ainer}@());
\end{itemdecl}
@@ -3845,6 +3861,7 @@
namespace std {
template <@\changedConcepts{class}{ObjectType}@ T, @\changedConcepts{class}{BackInsertionSequence}@ Cont@\removedConcepts{ainer}@ = deque<T> >
@\addedConcepts{requires SameType<Cont::value_type, T>}@
+ @\addedConcepts{\&\& NothrowDestructible<Cont>}@
class stack {
public:
typedef typename Cont@\removedConcepts{ainer}@::value_type value_type;
@@ -3859,16 +3876,16 @@
@\addedConcepts{requires CopyConstructible<Cont>}@ explicit stack(const Cont@\removedConcepts{ainer}@&);
@\addedConcepts{requires MoveConstructible<Cont>}@ explicit stack(Cont@\removedConcepts{ainer}@&& = Cont@\removedConcepts{ainer}@());
template <class Alloc>
- @\addedConcepts{HasConstructor<Cont, Alloc>}@
+ @\addedConcepts{Constructible<Cont, Alloc>}@
explicit stack(const Alloc&);
template <class Alloc>
- @\addedConcepts{HasConstructor<Cont, Cont, Alloc>}@
+ @\addedConcepts{Constructible<Cont, Cont, Alloc>}@
stack(const Cont@\removedConcepts{ainer}@&, const Alloc&);
template <class Alloc>
- @\addedConcepts{HasConstructor<Cont, Cont\&\&, Alloc>}@
+ @\addedConcepts{Constructible<Cont, Cont\&\&, Alloc>}@
stack(Cont@\removedConcepts{ainer}@&&, const Alloc&);
template <class Alloc>
- @\addedConcepts{HasConstructor<Cont, Cont\&\&, Alloc>}@
+ @\addedConcepts{Constructible<Cont, Cont\&\&, Alloc>}@
stack(stack&&, const Alloc&);
bool empty() const { return @\removedCCC{c.}@empty(@\addedCC{c}@); }
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-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -76,8 +76,7 @@
\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}. Non-editorial
-changes from the previous wording are \addedCC{highlighted in green}.
+strike-through when possible}.
\editorial{Purely editorial comments will be written in a separate,
shaded box. These comments are not intended to be included in the
@@ -255,7 +254,25 @@
\paragraph*{Changes from N2695}
\begin{itemize}
-\item The \tcode{HasStdMove} concept has moved into Nxxxx, ``Supplemental Concepts for the C++0x Standard Library.''
+\item Replaced the \tcode{HasStdMove} concept (and its uses) with
+ \tcode{RvalueOf}, which is now part of the foundational concepts.
+\item In the \tcode{ShuffleIterator} concept, the
+ \tcode{HasConstructor} requirement on the \tcode{value_type} has
+ been replaced with the equivalent \tcode{Constructible} requirement;
+ the explicit \tcode{NothrowDestructible} requirement has
+ subsequently been removed.
+\item Added move-constructibility of the value type into the
+ \tcode{ShuffleIterator} concept.
+\item We permit the \tcode{iterator_traits} typedefs for output
+ iterators to be \tcode{void}. This behavior is permitted by
+ \Cpp{}03, and was previously thought to cause problems with the
+ backward-compatibility concept maps for output iterators (which
+ relied on non-\tcode{void} typedefs even for output
+ iterators). However, we determined that the concepts mechanism can
+ deduce these types for output iterators, therefore ignoring the
+ types specified in \tcode{iterator_traits} and allowing us to
+ re-instate this user leeway. In [iterator.backward]p2, we clarify
+ that we perform this deduction for output iterators.
\end{itemize}
@@ -1108,15 +1125,13 @@
\begin{codeblock}
auto concept ShuffleIterator<typename X> {
requires InputIterator<X>
- && NothrowDestructible<InputIterator<X>::value_type>
- && HasStdMove<InputIterator<X>::value_type>
- && HasStdMove<InputIterator<X>::reference>
- && OutputIterator<X, HasStdMove<InputIterator<X>::value_type>::result_type>
- && OutputIterator<X, HasStdMove<InputIterator<X>::reference>::result_type>
- && HasConstructor<InputIterator<X>::value_type,
- HasStdMove<InputIterator<X>::reference>::result_type>
+ && OutputIterator<X, RvalueOf<InputIterator<X>::value_type>::type>
+ && OutputIterator<X, RvalueOf<InputIterator<X>::reference>::type>
+ && Constructible<InputIterator<X>::value_type,
+ RvalueOf<InputIterator<X>::reference>::type>
+ && MoveConstructible<InputIterator<X>::value_type>
&& HasAssign<InputIterator<X>::value_type,
- HasStdMove<InputIterator<X>::reference>::result_type>
+ RvalueOf<InputIterator<X>::reference>::type>
&& HasSwap<InputIterator<X>::reference, InputIterator<X>::reference>;
}
\end{codeblock}
@@ -1189,16 +1204,16 @@
shall be defined as the iterator's reference and pointer types, that is, for an
iterator object \tcode{a}, the same type as the type of \tcode{*a} and \tcode{a->},
-respectively. \removedConcepts{In the case of an output iterator, the types}
+respectively. In the case of an output iterator, the types
\begin{codeblock}
-@\removedConcepts{iterator_traits<Iterator>::difference_type}@
-@\removedConcepts{iterator_traits<Iterator>::value_type}@
-@\removedConcepts{iterator_traits<Iterator>::reference}@
-@\removedConcepts{iterator_traits<Iterator>::pointer}@
+iterator_traits<Iterator>::difference_type
+iterator_traits<Iterator>::value_type
+iterator_traits<Iterator>::reference
+iterator_traits<Iterator>::pointer
\end{codeblock}
-\removedConcepts{may be defined as void.}
+may be defined as \tcode{void}.
\setcounter{Paras}{5}
\pnum
@@ -1347,10 +1362,52 @@
\pnum
\addedConcepts{The library provides concept maps that allow iterators
specified with \mbox{\tcode{iterator_traits}}
-to interoperate with algorithms that require iterator concepts. }
+to interoperate with algorithms that require iterator
+concepts. \enterexample}
+\begin{codeblock}
+struct random_iterator
+{
+ typedef std::input_iterator_tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int reference;
+
+ random_iterator(int remaining = 0) : remaining(remaining) { }
+
+ int operator*() const { return std::rand(); }
+ int* operator->() const { return 0; }
+
+ random_iterator& operator++() { --remaining; return *this; }
+
+ random_iterator operator++(int) {
+ random_iterator tmp(*this); ++(*this); return tmp;
+ }
+
+ int remaining;
+
+ friend bool
+ operator==(const random_iterator& i, const random_iterator& j)
+ {
+ return i.remaining == j.remaining;
+ }
+
+ friend bool
+ operator!=(const random_iterator& i, const random_iterator& j)
+ {
+ return i.remaining != j.remaining;
+ }
+};
+
+void f(random_iterator i, random_iterator j) {
+ std::copy(i, j, std::ostream_iterator<int>(std::cout, " ")); // okay: standard library produces concept
+ // map InputIterator<random_iterator>
+}
+\end{codeblock}
+\addedConcepts{\exitexample}
\pnum
-\addedConcepts{The
+\addedConcepts{For all iterator types except output iterators, the
associated types
\mbox{\tcode{difference_type}},
\mbox{\tcode{value_type}},
@@ -1358,7 +1415,9 @@
and
\mbox{\tcode{reference}}
are given the same values as their counterparts in
-\mbox{\tcode{iterator_traits}}.}
+\mbox{\tcode{iterator_traits}}. For output iterators, the
+\mbox{\tcode{reference}} type is deduced from the type of the output
+iterator's dereference operator.}
\pnum
\color{addclr}
Modified: sandbox/committee/concepts/stdlib/clib-suppconcepts.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-suppconcepts.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-suppconcepts.tex 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -8,7 +8,7 @@
\usepackage[pdftex,
pdftitle={Supplemental Concepts for the C++0x Standard Library},
- pdfsubject={C++ International Sßtandard Proposal},
+ pdfsubject={C++ International Standard Proposal},
pdfcreator={Douglas Gregor},
bookmarks=true,
bookmarksnumbered=true,
@@ -111,7 +111,6 @@
namespace std {
// \ref{concept.operator}, operator concepts:
auto concept HasComma<typename T, typename U> @\textit{see below}@;
- @\addedConcepts{auto concept HasStdMove<typename T> \mbox{\textit{see below}};}@
// \ref{concept.destruct}, destruction:
concept TriviallyDestructible<typename T> @\textit{see below}@;
@@ -145,37 +144,6 @@
\mbox{\tcode{std}}.
\end{itemdescr}
-\rSec2[concept.operator]{Operator concepts}
-\editorial{Add to the end of [concept.operator]}
-\setcounter{Paras}{42}
-\color{addclr}
-\begin{itemdecl}
-auto concept HasStdMove<typename T> {
- typename result_type = typename remove_reference<T>::type&&;
- result_type std_move(T&& x) { return x; }
-}
-\end{itemdecl}
-\color{black}
-
-\editorial{The \tcode{HasStdMove} concept is required to handle a
- pecularity with the \tcode{std::move} operation, whose result type
- is move a simple constructed by like \tcode{T\&\&} but a
- type metafunction involving \tcode{remove_reference}. Type
- metafunctions are at odds with concepts, because the former requires
- precise type information to compute a result (at template instantiation time)
- while the latter seeks to tie down details without precise types (at
- template definition time); thus, to accurately characterize the
- behavior of \tcode{std::move}, we encapsulate its return type in an
- associated type \tcode{result_type}, so that we can describe
- requirements on that return type.}
-
-\begin{itemdescr}
-\pnum
-\addedConcepts{\mbox{\reallynote} describes the behavior of the
- \mbox{\tcode{std::move}}
- operation and encapsulates its result in an associated type.}
-\end{itemdescr}
-
\editorial{Add to the end of [concept.destruct]}
\setcounter{section}{6}
\setcounter{Paras}{5}
Modified: sandbox/committee/concepts/stdlib/clib-utilities.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-utilities.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-utilities.tex 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -49,7 +49,7 @@
\begin{center}
\huge
Concepts for the C++0x Standard Library: Utilities\\
-(Revision 3)
+(Revision 4)
\vspace{0.5in}
@@ -62,8 +62,8 @@
\end{center}
\vspace{1in}
-\par\noindent Document number: N2622=08-0132\vspace{-6pt}
-\par\noindent Revises document number: N2322=07-0182\vspace{-6pt}
+\par\noindent Document number: DRAFT\vspace{-6pt}
+\par\noindent Revises document number: N2622=08-0132\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}
@@ -71,14 +71,11 @@
\section*{Introduction}
\libintrotext{Chapter 20}.
-\section*{Changes since N2322}
+\section*{Changes since N2622}
\begin{itemize}
-\item Added concept requirements to \tcode{make_pair} and
- \tcode{make_tuple}.
-\item Switched from \tcode{ObjectType} to \tcode{VariableType} in
- several components where we need to permit reference types.
-\item Many cleanups to bring specification up-to-date with changes to
- concepts wording and the core concepts.
+\item Replaced \tcode{HasConstructor} requirements with \tcode{Constructible} requirements.
+\item Constrain \tcode{move} with the \tcode{RvalueOf} concept.
+\item Constrain the \tcode{identity} helper template of \tcode{forward}.
\end{itemize}
\end{titlepage}
@@ -151,7 +148,7 @@
// \ref{forward}, forward/move:
template <class T> struct identity;
template <@\changedConcepts{class}{VariableType}@ T> T&& forward(typename identity<T>::type&&);
- template <@\changedConcepts{class}{VariableType}@ T> typename remove_reference<T>::type&& move(T&&);
+ template <@\changedConcepts{class}{RvalueOf}@ T> @\changedConcepts{typename remove_reference<T>::type\&\&}{RvalueOf<T>::type}@ move(T&&);
// \ref{pairs}, pairs:
template <@\changedConcepts{class}{ObjectType}@ T1,@\changedConcepts{class}{ObjectType}@ T2> struct pair;
@@ -281,7 +278,7 @@
\index{identity@\tcode{identity}}%
\begin{itemdecl}
-template <class T> struct identity { typedef T type; };
+template <@\changedConcepts{class}{VariableType}@ T> struct identity { typedef T type; };
\end{itemdecl}
\begin{itemdescr}
@@ -305,7 +302,7 @@
\setcounter{Paras}{6}
\index{move@\tcode{move}}%
\begin{itemdecl}
-template <@\changedConcepts{class}{VariableType}@ T> typename remove_reference<T>::type&& move(T&& t);
+template <@\changedConcepts{class}{RvalueOf}@ T> @\changedConcepts{typename remove_reference<T>::type\&\&}{RvalueOf<T>::type}@ move(T&& t);
\end{itemdecl}
\begin{itemdescr}
@@ -337,17 +334,17 @@
@\addedConcepts{requires DefaultConstructible<T1> \&\& DefaultConstructible<T2>}@ pair();
@\addedConcepts{requires CopyConstructible<T1> \&\& CopyConstructible<T2>}@ pair(const T1& @\farg{x}@, const T2& @\farg{y}@);
template<class @\farg{U}@, class @\farg{V}@>
- @\addedConcepts{requires HasConstructor<T1, U\&\&> \&\& HasConstructor<T2, V\&\&>}@
+ @\addedConcepts{requires Constructible<T1, U\&\&> \&\& Constructible<T2, V\&\&>}@
pair(U&& @\farg{x}@, V&& @\farg{y}@);
@\addedConcepts{requires MoveConstructible<T1> \&\& MoveConstructible<T2>}@ pair(pair&& @\farg{p}@);
template<class @\farg{U}@, class @\farg{V}@>
- @\addedConcepts{requires HasConstructor<T1, U> \&\& HasConstructor<T2, V>}@
+ @\addedConcepts{requires Constructible<T1, U> \&\& Constructible<T2, V>}@
pair(const pair<@\farg{U}@, @\farg{V}@>& @\farg{p}@);
template<class @\farg{U}@, class @\farg{V}@>
- @\addedConcepts{requires HasConstructor<T1, U\&\&> \&\& HasConstructor<T2, V\&\&>}@
+ @\addedConcepts{requires Constructible<T1, U\&\&> \&\& Constructible<T2, V\&\&>}@
pair(pair<@\farg{U}@, @\farg{V}@>&& @\farg{p}@);
template<class @\farg{U}@, class... @\farg{Args}@>
- @\addedConcepts{requires HasConstructor<T1, U\&\&> \&\& HasConstructor<T2, Args\&\&...>}@
+ @\addedConcepts{requires Constructible<T1, U\&\&> \&\& Constructible<T2, Args\&\&...>}@
pair(U&& @\farg{x}@, Args&&... @\farg{args}@);
// allocator-extended constructors
@@ -440,7 +437,7 @@
\begin{itemdecl}
template<class @\farg{U}@, class @\farg{V}@>
- @\addedConcepts{requires HasConstructor<T1, U\&\&> \&\& HasConstructor<T2, V\&\&>}@
+ @\addedConcepts{requires Constructible<T1, U\&\&> \&\& Constructible<T2, V\&\&>}@
pair(U&& @\farg{x}@, V&& @\farg{y}@);
\end{itemdecl}
@@ -495,7 +492,7 @@
\begin{itemdecl}
template<class U, class... Args>
- @\addedConcepts{requires HasConstructor<T1, U\&\&> \&\& HasConstructor<T2, Args\&\&...>}@
+ @\addedConcepts{requires Constructible<T1, U\&\&> \&\& Constructible<T2, Args\&\&...>}@
pair(U&& x, Args&&... args);
\end{itemdecl}
@@ -799,24 +796,24 @@
@\addedConcepts{requires DefaultConstructible<Types>...}@ tuple();
@\addedConcepts{requires CopyConstructible<Types>...}@ explicit tuple(const Types&...);
template <class... UTypes>
- @\addedConcepts{requires HasConstructor<Types, UTypes\&\&>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes\&\&>...}@
explicit tuple(UTypes&&...);
@\addedConcepts{requires CopyConstructible<Types>...}@ tuple(const tuple&);
@\addedConcepts{requires MoveConstructible<Types>...}@ tuple(tuple&&);
template <class... UTypes>
- @\addedConcepts{requires HasConstructor<Types, UTypes>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes>...}@
tuple(const tuple<UTypes...>&);
template <class... UTypes>
- @\addedConcepts{requires HasConstructor<Types, UTypes\&\&>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes\&\&>...}@
tuple(tuple<UTypes...>&&);
template <@\changedConcepts{class U1, class U2}{class... UTypes}@>
- @\addedConcepts{requires HasConstructor<Types, UTypes>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes>...}@
tuple(const pair<@\changedConcepts{U1, U2}{UTypes...}@>&); @\removedConcepts{// iff \mbox{\tcode{sizeof...(Types) == 2}}}@
template <@\changedConcepts{class U1, class U2}{class... UTypes}@>
- @\addedConcepts{requires HasConstructor<Types, UTypes\&\&>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes\&\&>...}@
tuple(pair<@\changedConcepts{U1, U2}{UTypes...}@>&&); @\removedConcepts{// iff \mbox{\tcode{sizeof...(Types) == 2}}}@
// allocator-extended constructors
@@ -906,7 +903,7 @@
\index{tuple@\tcode{tuple}!tuple@\tcode{tuple}}%
\begin{itemdecl}
@\addedD{template <class... UTypes>}@
- @\addedConcepts{requires HasConstructor<Types, UTypes\&\&>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes\&\&>...}@
@\addedD{tuple(UTypes\&\&... u);}@
\end{itemdecl}
@@ -955,7 +952,7 @@
\index{tuple@\tcode{tuple}!tuple@\tcode{tuple}}%
\begin{itemdecl}
template <@\addedD{class... UTypes}@>
- @\addedConcepts{requires HasConstructor<Types, UTypes>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes>...}@
tuple(const tuple<@\addedD{UTypes...}@>& u);
\end{itemdecl}
@@ -986,7 +983,7 @@
\index{tuple@\tcode{tuple}!tuple@\tcode{tuple}}%
\begin{itemdecl}
template <class... UTypes>
- @\addedConcepts{requires HasConstructor<Types, UTypes\&\&>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes\&\&>...}@
tuple(tuple<UTypes...>&& u);
\end{itemdecl}
@@ -1010,7 +1007,7 @@
\index{pair@\tcode{pair}}%
\begin{itemdecl}
template <@\changedConcepts{class U1, class U2}{class... UTypes}@>
- @\addedConcepts{requires HasConstructor<Types, UTypes>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes>...}@
tuple(const pair<@\changedConcepts{U1, U2}{UTypes...}@>&);
\end{itemdecl}
@@ -1031,7 +1028,7 @@
\index{pair@\tcode{pair}}%
\begin{itemdecl}
template <@\changedConcepts{class U1, class U2}{class... UTypes}@>
- @\addedConcepts{requires HasConstructor<Types, UTypes\&\&>...}@
+ @\addedConcepts{requires Constructible<Types, UTypes\&\&>...}@
tuple(pair<@\changedConcepts{U1, U2}{UTypes...}@>&&);
\end{itemdecl}
Modified: sandbox/committee/concepts/stdlib/macros.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/macros.tex (original)
+++ sandbox/committee/concepts/stdlib/macros.tex 2008-08-16 11:48:11 EDT (Sat, 16 Aug 2008)
@@ -1123,7 +1123,7 @@
knowingly changed semantics.
This document is formatted in the same manner as the latest working draft of
-the \Cpp{} standard (N2588). Future versions of this document will
+the \Cpp{} standard (N2691). Future versions of this document will
track the working draft and the concepts proposal as they
evolve. Wherever the numbering of a (sub)section matches a section of
the working paper, the text in this document should be considered
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