Created on 2001-12-02.00:00:00 last changed 171 months ago
[
Pre Bellevue: It was recognized that this was taken care of by
N1856,
and thus moved from NAD Future to NAD EditorialResolved.
]
[ Curaçao: There is no indication this is was anything other than a design decision, and thus NAD. May be appropriate for a future standard. ]
Proposed resolution:
Add the following declaration to the definition of std::pair:
template<class U, class V> pair& operator=(const pair<U, V> &p);
And also add a paragraph describing the effects of the function template to the end of 20.2.2:
template<class U, class V> pair& operator=(const pair<U, V> &p);
Effects: first = p.first; second = p.second; Returns: *this
The class template std::pair defines a template ctor (20.2.2, p4) but no template assignment operator. This may lead to inefficient code since assigning an object of pair<C, D> to pair<A, B> where the types C and D are distinct from but convertible to A and B, respectively, results in a call to the template copy ctor to construct an unnamed temporary of type pair<A, B> followed by an ordinary (perhaps implicitly defined) assignment operator, instead of just a straight assignment.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-11-19 19:04:45 | admin | set | status: nad editorial -> resolved |
2010-10-21 18:28:33 | admin | set | messages: + msg2328 |
2010-10-21 18:28:33 | admin | set | messages: + msg2327 |
2010-10-21 18:28:33 | admin | set | messages: + msg2326 |
2001-12-02 00:00:00 | admin | create |