Changeset 48323
 Timestamp:
 Aug 23, 2008, 8:25:06 PM (10 years ago)
 Location:
 sandbox/committee/concepts/stdlib
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

sandbox/committee/concepts/stdlib/clibconcepts.tex
r48273 r48323 133 133 \item Added the \tcode{underlying_type} associated type to the 134 134 \tcode{EnumerationType} concept. 135 136 \item Added the \tcode{IdentityOf} concept, which acts like a simple 137 identity metafunction. It is used by \tcode{std::forward}. 135 138 \end{itemize} 136 139 … … 239 242 concept DerivedFrom<typename Derived, typename Base> { } 240 243 241 // \ref{concept.rvalue}, rvalue: 244 // \ref{concept.transform}, type transformations: 245 auto concept IdentityOf<typename T> @\textit{see below}@; 242 246 auto concept RvalueOf<typename T> @\textit{see below}@; 243 247 template<typename T> concept_map RvalueOf<T&> @\textit{see below}@; … … 688 692 \end{itemdescr} 689 693 690 \rSec2[concept.rvalue]{Rvalue} 694 \rSec2[concept.transform]{Type transformations} 695 \begin{itemdecl} 696 auto concept IdentityOf<typename T> { 697 typename type = T; 698 requires SameType<type, T>; 699 } 700 \end{itemdecl} 701 702 \begin{itemdescr} 703 \pnum 704 \addedConcepts{\mbox{\reallynote} concept form of the \mbox{\tcode{identity}} type metafunction (\mbox{\ref{forward}}).} 705 \end{itemdescr} 706 691 707 \begin{itemdecl} 692 708 auto concept RvalueOf<typename T> { 
sandbox/committee/concepts/stdlib/clibutilities.tex
r48273 r48323 76 76 \item Replaced \tcode{HasConstructor} requirements with \tcode{Constructible} requirements. 77 77 \item Constrain \tcode{move} with the \tcode{RvalueOf} concept. 78 \item Constrain the \tcode{identity} helper template of \tcode{forward}. 78 \item Constrain the \tcode{identity} template, which has been moved 79 to~\ref{function.objects} since it is not used by 80 \tcode{forward}. Instead, we use the \tcode{IdentityOf} concept. 79 81 \item Fixed syntactic errors in the \tcode{mem_fn} signatures. 80 82 \item Constrain \tcode{tuple_element}, \tcode{tuple_size}. … … 99 101 constrained templates solves the problem of construction from a 100 102 literal 0. 103 \item[Issue 823. \tcode{identity<void>} seems broken.] Applied the proposed resolution to \tcode{identity}, which constrains the function call operator with a \tcode{ReferentType} requirement. 101 104 \end{description} 102 105 … … 167 170 168 171 // \ref{forward}, forward/move: 169 template <@\changedConcepts{class}{VariableType}@ T> struct identity;170 template <@\changedConcepts{class}{ VariableType}@ T> T&& forward(typename identity<T>::type&&);172 @\removedConcepts{template <class T> struct identity;}@ 173 template <@\changedConcepts{class}{IdentityOf}@ T> T&& forward(@\changedConcepts{typename identity<T>}{IdentityOf<T>}@::type&&); 171 174 template <@\changedConcepts{class}{RvalueOf}@ T> @\changedConcepts{typename remove_reference<T>::type\&\&}{RvalueOf<T>::type}@ move(T&&); 172 175 … … 297 300 of forwarding functions.} 298 301 299 \index{identity@\tcode{identity}}% 300 \begin{itemdecl} 301 template <@\changedConcepts{class}{VariableType}@ T> struct identity { typedef T type; }; 302 \end{itemdecl} 303 304 \begin{itemdescr} 305 \pnum 306 \addedD{\mbox{\enternote} The use of \mbox{\tcode{identity}} in 302 \editorial{\tcode{identity} is no longer used to make the argument 303 type nondeduced. Instead, we use the \tcode{IdentityOf} concept and 304 its associated type \tcode{type}, and have moved \tcode{identity} 305 to~\ref{function.objects}.} 306 307 \index{forward@\tcode{forward}}% 308 \begin{itemdecl} 309 template <@\changedConcepts{class}{IdentityOf}@ T> T&& forward(@\changedConcepts{typename identity<T>}{IdentityOf<T>}@::type&& t); 310 \end{itemdecl} 311 312 \begin{itemdescr} 313 \pnum 314 \mbox{\enternote} The use of \changedConcepts{\mbox{\tcode{identity}}}{\mbox{\tcode{IdentityOf}}} in 307 315 \mbox{\tcode{forward}} forces users to explicitly specify the 308 316 template parameter. This is necessary to get the correct forwarding 309 semantics.\mbox{\exitnote}} 310 \end{itemdescr} 311 312 \index{forward@\tcode{forward}}% 313 \begin{itemdecl} 314 template <@\changedConcepts{class}{VariableType}@ T> T&& forward(typename identity<T>::type&& t); 315 \end{itemdecl} 316 317 \begin{itemdescr} 317 semantics.\mbox{\exitnote} 318 318 319 \pnum 319 320 \addedD{\mbox{\returns} \mbox{\tcode{t}}.} … … 1614 1615 template <@\changedConcepts{class}{ObjectType}@ T> reference_wrapper<const T> cref(reference_wrapper<T>); 1615 1616 1617 // \ref{identity.operation}, identity operation: 1618 @\addedConcepts{template <class T> struct identity;}@ 1619 1616 1620 // \ref{arithmetic.operations}, arithmetic operations: 1617 template < classT> struct plus;1618 template < classT> struct minus;1619 template < classT> struct multiplies;1620 template < classT> struct divides;1621 template < classT> struct modulus;1622 template < classT> struct negate;1621 template <@\changedConcepts{class}{ReferentType}@ T> struct plus; 1622 template <@\changedConcepts{class}{ReferentType}@ T> struct minus; 1623 template <@\changedConcepts{class}{ReferentType}@ T> struct multiplies; 1624 template <@\changedConcepts{class}{ReferentType}@ T> struct divides; 1625 template <@\changedConcepts{class}{ReferentType}@ T> struct modulus; 1626 template <@\changedConcepts{class}{ReferentType}@ T> struct negate; 1623 1627 1624 1628 // \ref{comparisons}, comparisons: 1625 template < classT> struct equal_to;1626 template < classT> struct not_equal_to;1627 template < classT> struct greater;1628 template < classT> struct less;1629 template < classT> struct greater_equal;1630 template < classT> struct less_equal;1629 template <@\changedConcepts{class}{ReferentType}@ T> struct equal_to; 1630 template <@\changedConcepts{class}{ReferentType}@ T> struct not_equal_to; 1631 template <@\changedConcepts{class}{ReferentType}@ T> struct greater; 1632 template <@\changedConcepts{class}{ReferentType}@ T> struct less; 1633 template <@\changedConcepts{class}{ReferentType}@ T> struct greater_equal; 1634 template <@\changedConcepts{class}{ReferentType}@ T> struct less_equal; 1631 1635 1632 1636 // \ref{logical.operations}, logical operations: 1633 template < classT> struct logical_and;1634 template < classT> struct logical_or;1635 template < classT> struct logical_not;1637 template <@\changedConcepts{class}{ReferentType}@ T> struct logical_and; 1638 template <@\changedConcepts{class}{ReferentType}@ T> struct logical_or; 1639 template <@\changedConcepts{class}{ReferentType}@ T> struct logical_not; 1636 1640 1637 1641 // \ref{bitwise.operations}, bitwise operations: 1638 template < classT> struct bit_and;1639 template < classT> struct bit_or;1640 template < classT> struct bit_xor;1642 template <@\changedConcepts{class}{ReferentType}@ T> struct bit_and; 1643 template <@\changedConcepts{class}{ReferentType}@ T> struct bit_or; 1644 template <@\changedConcepts{class}{ReferentType}@ T> struct bit_xor; 1641 1645 1642 1646 // \ref{negators}, negators: … … 1744 1748 1745 1749 // \marktr{}\ref{unord.hash}, hash function base template: 1746 template < classT> struct hash;1750 template <@\changedConcepts{class}{ReferentType}@ T> struct hash; 1747 1751 1748 1752 // Hash function specializations … … 1767 1771 template <> struct hash<long double>; 1768 1772 1769 template< classT> struct hash<T*>;1773 template<@\changedConcepts{class}{PointeeType}@ T> struct hash<T*>; 1770 1774 1771 1775 template <> struct hash<std::string>; … … 1886 1890 \end{itemdescr} 1887 1891 1892 \editorial{Add the following new section [identity.operation]} 1893 \rSec2[identity.operation]{Identity operation} 1894 \index{identity@\tcode{identity}}% 1895 \begin{itemdecl} 1896 template <@\changedConcepts{class}{IdentityOf}@ T> struct identity { 1897 typedef T type; 1898 1899 @\addedConcepts{requires ReferentType<T>}@ 1900 const T& operator()(const T& x) const; 1901 }; 1902 \end{itemdecl} 1903 1904 \begin{itemdecl} 1905 @\addedConcepts{requires ReferentType<T>}@ 1906 const T& operator()(const T& x) const; 1907 \end{itemdecl} 1908 1909 \begin{itemdescr} 1910 \pnum 1911 \returns\ 1912 \tcode{x} 1913 \end{itemdescr} 1914 1888 1915 \rSec2[arithmetic.operations]{Arithmetic operations} 1889 1916 … … 1894 1921 \index{plus@\tcode{plus}}% 1895 1922 \begin{itemdecl} 1896 template < classT> struct plus : binary_function<T,T,T> {1923 template <@\changedConcepts{class}{ReferentType}@ T> struct plus : binary_function<T,T,T> { 1897 1924 @\addedConcepts{requires HasPlus<T> \&\& Convertible<T::result_type, T>}@ 1898 1925 T operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 1909 1936 \index{minus@\tcode{minus}}% 1910 1937 \begin{itemdecl} 1911 template < classT> struct minus : binary_function<T,T,T> {1938 template <@\changedConcepts{class}{ReferentType}@ T> struct minus : binary_function<T,T,T> { 1912 1939 @\addedConcepts{requires HasMinus<T> \&\& Convertible<T::result_type, T>}@ 1913 1940 T operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 1924 1951 \index{multiplies@\tcode{multiplies}}% 1925 1952 \begin{itemdecl} 1926 template < classT> struct multiplies : binary_function<T,T,T> {1953 template <@\changedConcepts{class}{ReferentType}@ T> struct multiplies : binary_function<T,T,T> { 1927 1954 @\addedConcepts{requires HasMultiply<T> \&\& Convertible<T::result_type, T>}@ 1928 1955 T operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 1939 1966 \index{divides@\tcode{divides}}% 1940 1967 \begin{itemdecl} 1941 template < classT> struct divides : binary_function<T,T,T> {1968 template <@\changedConcepts{class}{ReferentType}@ T> struct divides : binary_function<T,T,T> { 1942 1969 @\addedConcepts{requires HasDivide<T> \&\& Convertible<T::result_type, T>}@ 1943 1970 T operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 1954 1981 \index{modulus@\tcode{modulus}}% 1955 1982 \begin{itemdecl} 1956 template < classT> struct modulus : binary_function<T,T,T> {1983 template <@\changedConcepts{class}{ReferentType}@ T> struct modulus : binary_function<T,T,T> { 1957 1984 @\addedConcepts{requires HasModulus<T> \&\& Convertible<T::result_type, T>}@ 1958 1985 T operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 1967 1994 \index{negate@\tcode{negate}}% 1968 1995 \begin{itemdecl} 1969 template < classT> struct negate : unary_function<T,T> {1996 template <@\changedConcepts{class}{ReferentType}@ T> struct negate : unary_function<T,T> { 1970 1997 @\addedConcepts{requires HasNegate<T> \&\& Convertible<T::result_type, T>}@ 1971 1998 T operator()(const T& @\farg{x}@) const; … … 1986 2013 \index{equal_to@\tcode{equal_to}}% 1987 2014 \begin{itemdecl} 1988 template < classT> struct equal_to : binary_function<T,T,bool> {2015 template <@\changedConcepts{class}{ReferentType}@ T> struct equal_to : binary_function<T,T,bool> { 1989 2016 @\addedConcepts{requires HasEqualTo<T, T>}@ 1990 2017 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 1999 2026 \index{not_equal_to@\tcode{not_equal_to}}% 2000 2027 \begin{itemdecl} 2001 template < classT> struct not_equal_to : binary_function<T,T,bool> {2028 template <@\changedConcepts{class}{ReferentType}@ T> struct not_equal_to : binary_function<T,T,bool> { 2002 2029 @\addedConcepts{requires HasNotEqualTo<T, T>}@ 2003 2030 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2012 2039 \index{greater@\tcode{greater}}% 2013 2040 \begin{itemdecl} 2014 template < classT> struct greater : binary_function<T,T,bool> {2041 template <@\changedConcepts{class}{ReferentType}@ T> struct greater : binary_function<T,T,bool> { 2015 2042 @\addedConcepts{requires HasGreater<T, T>}@ 2016 2043 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2025 2052 \index{less@\tcode{less}}% 2026 2053 \begin{itemdecl} 2027 template < classT> struct less : binary_function<T,T,bool> {2054 template <@\changedConcepts{class}{ReferentType}@ T> struct less : binary_function<T,T,bool> { 2028 2055 @\addedConcepts{requires HasLess<T, T>}@ 2029 2056 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2038 2065 \index{greater_equal@\tcode{greater_equal}}% 2039 2066 \begin{itemdecl} 2040 template < classT> struct greater_equal : binary_function<T,T,bool> {2067 template <@\changedConcepts{class}{ReferentType}@ T> struct greater_equal : binary_function<T,T,bool> { 2041 2068 @\addedConcepts{requires HasGreaterEqual<T, T>}@ 2042 2069 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2051 2078 \index{less_equal@\tcode{less_equal}}% 2052 2079 \begin{itemdecl} 2053 template < classT> struct less_equal : binary_function<T,T,bool> {2080 template <@\changedConcepts{class}{ReferentType}@ T> struct less_equal : binary_function<T,T,bool> { 2054 2081 @\addedConcepts{requires HasLessEqual<T, T>}@ 2055 2082 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2076 2103 \index{logical_and@\tcode{logical_and}}% 2077 2104 \begin{itemdecl} 2078 template < classT> struct logical_and : binary_function<T,T,bool> {2105 template <@\changedConcepts{class}{ReferentType}@ T> struct logical_and : binary_function<T,T,bool> { 2079 2106 @\addedConcepts{requires HasLogicalAnd<T, T>}@ 2080 2107 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2089 2116 \index{logical_or@\tcode{logical_or}}% 2090 2117 \begin{itemdecl} 2091 template < classT> struct logical_or : binary_function<T,T,bool> {2118 template <@\changedConcepts{class}{ReferentType}@ T> struct logical_or : binary_function<T,T,bool> { 2092 2119 @\addedConcepts{requires HasLogicalOr<T, T>}@ 2093 2120 bool operator()(const T& @\farg{x}@, const T& @\farg{y}@) const; … … 2102 2129 \index{logical_not@\tcode{logical_not}}% 2103 2130 \begin{itemdecl} 2104 template < classT> struct logical_not : unary_function<T,bool> {2131 template <@\changedConcepts{class}{ReferentType}@ T> struct logical_not : unary_function<T,bool> { 2105 2132 @\addedConcepts{requires HasLogicalNot<T>}@ 2106 2133 bool operator()(const T& @\farg{x}@) const; … … 2121 2148 \index{bit_and@\tcode{bit_and}}% 2122 2149 \begin{itemdecl} 2123 template < classT> struct bit_and : binary_function<T,T,T> {2150 template <@\changedConcepts{class}{ReferentType}@ T> struct bit_and : binary_function<T,T,T> { 2124 2151 @\addedConcepts{requires HasBitAnd<T, T>}@ 2125 2152 T operator()(const T& x, const T& y) const; … … 2134 2161 \index{bit_or@\tcode{bit_or}}% 2135 2162 \begin{itemdecl} 2136 template < classT> struct bit_or : binary_function<T,T,T> {2163 template <@\changedConcepts{class}{ReferentType}@ T> struct bit_or : binary_function<T,T,T> { 2137 2164 @\addedConcepts{requires HasBitOr<T, T>}@ 2138 2165 T operator()(const T& x, const T& y) const; … … 2147 2174 \index{bit_xor@\tcode{bit_xor}}% 2148 2175 \begin{itemdecl} 2149 template < classT> struct bit_xor : binary_function<T,T,T> {2176 template <@\changedConcepts{class}{ReferentType}@ T> struct bit_xor : binary_function<T,T,T> { 2150 2177 @\addedConcepts{requires HasBitXor<T, T>}@ 2151 2178 T operator()(const T& x, const T& y) const;
Note: See TracChangeset
for help on using the changeset viewer.