Author: | Thorsten Ottosen |
---|---|
Contact: | thorsten.ottosen@dezide.com |
organizations: | Dezide Aps |
Date: | 2006-04-18 |
Number: | WG21/N2244 J16/07-0104 |
Working Group: | Library |
Abstract
This paper provides wording for the type-trait decay and new wording for the functions make_pair of make_tuple to make them optimally efficient. This change was motivated in n2069.
Each numbered section below describes a new section for the standard or modifications to an existing section. Comments are written in bold and are not part of the wording.
The author would like to thank Douglas Gregor and Howard Hinnant. Any mistake is the responsibility of the author.
Extend the synopsis of 20.4.2 to include the following
template <class T> struct decay;
Add the following row to Table 46 (Other transformations):
Template | Condition | Comments |
---|---|---|
template <class T> struct decay; | Let U be remove_reference<T>::type. If is_array<U>::value is true, the member typedef type shall equal remove_extent<U>::type*. If is_function<U>::value is true, the member typedef type shall equal add_pointer<U>::type. Otherwise the member typedef type equals U. |
Modify make_pair() in the synopsis of 20.2 to read
template<class T1, class T2> pair< typename decay<T1>::type, typename decay<T2>::type > make_pair(T1&&, T2&&);
Modify the specification of make_pair() in 20.2.2 to read
template<class T1, class T2> pair< typename decay<T1>::type, typename decay<T2>::type > make_pair(T1&& x, T2&& y);
Returns: pair< typename decay<T1>::type, typename decay<T2>::type >( forward<T1>(x), forward<T2>(y) )
and remove the footnote 222.
Modify the specification of make_tuple() in 20.3.1.2 to read
template<class... Types> tuple<VTypes...> make_tuple( Types&&... t);
where each Vi in VTypes is X& if for the corresponding type Ti in Types remove_cv< remove_reference<Ti>::type >::type equals reference_wrapper<X>, otherwise Vi is decay<Ti>::type.
Returns: tuple<VTypes...>(forward<Types>(t)...)