Title
pair default template argument
Status
nad
Section
[pairs]
Submitter
Thorsten Ottosen

Created on 2008-05-23.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

std::pair is a heterogeneous container.

Date: 2010-10-21.18:28:33

Proposed resolution:

Change the synopsis in [utility] to read:

template <class T1, class T2 = T1> struct pair;

Change [pairs] to read:

namespace std {
 template <class T1, class T2 = T1>
 struct pair {
   typedef T1 first_type;
   typedef T2 second_type;
   ...
Date: 2008-05-23.00:00:00

I have one issue with std::pair. Well, it might just be a very annoying historical accident, but why is there no default template argument for the second template argument? This is so annoying when the type in question is looong and hard to write (type deduction with auto won't help those cases where we use it as a return or argument type).

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4016
2010-10-21 18:28:33adminsetmessages: + msg4015
2008-05-23 00:00:00admincreate