|
Boost-Commit : |
From: dgregor_at_[hidden]
Date: 2008-06-29 09:56:21
Author: dgregor
Date: 2008-06-29 09:56:19 EDT (Sun, 29 Jun 2008)
New Revision: 46846
URL: http://svn.boost.org/trac/boost/changeset/46846
Log:
Rename Movable to HasStdMove, and describe its addition to the concepts header. Also, fix the concept maps from C++0x iterators to C++98/03 iterators
Text files modified:
sandbox/committee/concepts/stdlib/clib-algorithms.tex | 23 +++----
sandbox/committee/concepts/stdlib/clib-iterators.tex | 108 ++++++++++++++++++++++++++++++----------
2 files changed, 91 insertions(+), 40 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-06-29 09:56:19 EDT (Sun, 29 Jun 2008)
@@ -246,14 +246,14 @@
@\textcolor{black}{// \ref{alg.move}, move:}@
template<InputIterator InIter, @\changedCCC{OutputIterator<auto, InIter::value_type\&\&>}{typename}@ OutIter>
- @\addedCC{requires Movable<InIter::reference>}@
- @\addedCC{\&\& OutputIterator<OutIter, Movable<InIter::reference>::result_type>}@
+ @\addedCC{requires HasStdMove<InIter::reference>}@
+ @\addedCC{\&\& OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>}@
OutIter move(InIter @\farg{first}@, InIter @\farg{last}@,
OutIter @\farg{result}@);
template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
requires @\removedCCC{HasMoveAssign<OutIter::reference, InIter::value_type>}@
- @\addedCC{Movable<InIter::reference>}@
- @\addedCC{\&\& OutputIterator<OutIter, Movable<InIter::reference>::result_type>}@
+ @\addedCC{HasStdMove<InIter::reference>}@
+ @\addedCC{\&\& OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>}@
OutIter move_backward(InIter @\farg{first}@, InIter @\farg{last}@,
OutIter @\farg{result}@);
@@ -1600,16 +1600,13 @@
\color{addclr}
\begin{itemdecl}
template<InputIterator InIter, @\changedCCC{OutputIterator<auto, InIter::value_type\&\&>}{typename}@ OutIter>
- @\addedCC{requires Movable<InIter::reference>}@
- @\addedCC{\&\& OutputIterator<OutIter, Movable<InIter::reference>::result_type>}@
+ @\addedCC{requires HasStdMove<InIter::reference>}@
+ @\addedCC{\&\& OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>}@
OutIter move(InIter first, InIter last,
OutIter result);
\end{itemdecl}
\color{black}
-% DPG FIXME: think about the use of value_type here, and how it
-% interacts with proxy iterators.
-
\begin{itemdescr}
\pnum
\addedD{\mbox{\effects}
@@ -1619,7 +1616,7 @@
For each non-negative integer
\mbox{\tcode{n < (\farg{last}-\farg{first})}},
performs
-\mbox{\tcode{*(\farg{result}\ + n)}} \mbox{\tcode{= std::move(*(\farg{first}\ + n))}}.}
+\mbox{\tcode{*(\farg{result}\ + n)}} \mbox{\tcode{=}}} \changedCCC{\mbox{\tcode{std::move}}}{\mbox{\tcode{std_move}}}\addedD{\mbox{\tcode{(*(\farg{first}\ + n))}}.}
\pnum
\addedD{\mbox{\returns}
@@ -1643,8 +1640,8 @@
\begin{itemdecl}
template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
requires @\removedCCC{HasMoveAssign<OutIter::reference, InIter::value_type>}@
- @\addedCC{Movable<InIter::reference>}@
- @\addedCC{\&\& OutputIterator<OutIter, Movable<InIter::reference>::result_type>}@
+ @\addedCC{HasStdMove<InIter::reference>}@
+ @\addedCC{\&\& OutputIterator<OutIter, HasStdMove<InIter::reference>::result_type>}@
OutIter move_backward(InIter first, InIter last,
OutIter result);
\end{itemdecl}
@@ -1669,7 +1666,7 @@
\addedD{For each positive integer
\mbox{\tcode{n <= (\farg{last}\ - \farg{first})}},
performs
-\mbox{\tcode{*(\farg{result}\ - n) = std::move(*(\farg{last}\ - n))}}.}
+\mbox{\tcode{*(\farg{result}\ - n) =}}} \changedCCC{\mbox{\tcode{std::move}}}{\mbox{\tcode{std_move}}}\addedD{\mbox{\tcode{(*(\farg{last}\ - n))}}.}
\pnum
\addedD{\mbox{\requires}
Modified: sandbox/committee/concepts/stdlib/clib-iterators.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-iterators.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-iterators.tex 2008-06-29 09:56:19 EDT (Sun, 29 Jun 2008)
@@ -268,6 +268,8 @@
\end{titlepage}
+\section*{Proposed Wording}
+
%% --------------------------------------------------
%% Headers and footers
\pagestyle{fancy}
@@ -286,6 +288,46 @@
\renewcommand{\sectionmark}[1]{\markright{\thesection\hspace{1em}#1}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
+\setcounter{chapter}{20}
+\rSec1[utility.concepts]{Concepts}
+\editorial{Add to the header \tcode{<concepts>} synopsis at the end of
+the [concept.operator] section}
+\begin{codeblock}
+auto concept HasComma<typename T, typename U> @\textit{see below}@ ;
+@\addedCC{auto concept HasStdMove<typename T> \mbox{\textit{see below}} ;}
+\end{codeblock}
+
+\setcounter{section}{7}
+\rSec2[concept.operator]{Operator concepts}
+\editorial{Add to the end of [concept.operator]}
+\setcounter{Paras}{42}
+\color{ccadd}
+\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
+\addedCC{\mbox{\reallynote} describes the \mbox{\tcode{std::move}}
+ operation and encapsulates its result in an associated type.}
+\end{itemdescr}
+
\setcounter{chapter}{23}
\rSec0[iterators]{Iterators library}
@@ -1151,14 +1193,14 @@
auto concept MovableIterator<typename X> {
requires InputIterator<X>
&& NothrowDestructible<InputIterator<X>::value_type>
- && Movable<InputIterator<X>::value_type>
- && Movable<InputIterator<X>::reference>
- && OutputIterator<X, Movable<InputIterator<X>::value_type>::result_type>
- && OutputIterator<X, Movable<InputIterator<X>::reference>::result_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,
- Movable<InputIterator<X>::reference>::result_type>
+ HasStdMove<InputIterator<X>::reference>::result_type>
&& HasAssign<InputIterator<X>::value_type,
- Movable<InputIterator<X>::reference>::result_type>
+ HasStdMove<InputIterator<X>::reference>::result_type>
&& HasSwap<InputIterator<X>::reference, InputIterator<X>::reference>;
}
\end{codeblock}
@@ -1253,6 +1295,12 @@
14882:2003.}
\color{ccadd}
\begin{codeblock}
+concept IsReference<typename T> { } // exposition only
+template<typename T> concept_map IsReference<T&> { }
+
+concept IsPointer<typename T> { } // exposition only
+template<typename T> concept_map IsPointer<T*> { }
+
template<Iterator Iter> struct iterator_traits<Iter> {
typedef void difference_type;
typedef void value_type;
@@ -1269,29 +1317,35 @@
typedef input_iterator_tag iterator_category;
};
-template<ForwardIterator Iter> struct iterator_traits<Iter> {
- typedef Iter::difference_type difference_type;
- typedef Iter::value_type value_type;
- typedef Iter::pointer pointer;
- typedef Iter::reference reference;
- typedef forward_iterator_tag iterator_category;
-};
+template<ForwardIterator Iter>
+ requires IsReference<Iter::reference> && IsPointer<Iter::pointer>
+ struct iterator_traits<Iter> {
+ typedef Iter::difference_type difference_type;
+ typedef Iter::value_type value_type;
+ typedef Iter::pointer pointer;
+ typedef Iter::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ };
-template<BidirectionalIterator Iter> struct iterator_traits<Iter> {
- typedef Iter::difference_type difference_type;
- typedef Iter::value_type value_type;
- typedef Iter::pointer pointer;
- typedef Iter::reference reference;
- typedef bidirectional_iterator_tag iterator_category;
-};
+template<BidirectionalIterator Iter>
+ requires IsReference<Iter::reference> && IsPointer<Iter::pointer>
+ struct iterator_traits<Iter> {
+ typedef Iter::difference_type difference_type;
+ typedef Iter::value_type value_type;
+ typedef Iter::pointer pointer;
+ typedef Iter::reference reference;
+ typedef bidirectional_iterator_tag iterator_category;
+ };
-template<RandomAccessIterator Iter> struct iterator_traits<Iter> {
- typedef Iter::difference_type difference_type;
- typedef Iter::value_type value_type;
- typedef Iter::pointer pointer;
- typedef Iter::reference reference;
- typedef random_access_iterator_tag iterator_category;
-};
+template<RandomAccessIterator Iter>
+ requires IsReference<Iter::reference> && IsPointer<Iter::pointer>
+ struct iterator_traits<Iter> {
+ typedef Iter::difference_type difference_type;
+ typedef Iter::value_type value_type;
+ typedef Iter::pointer pointer;
+ typedef Iter::reference reference;
+ typedef random_access_iterator_tag iterator_category;
+ };
\end{codeblock}
\exitnote\
\color{black}
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