This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

### 840. `pair` default template argument

Section: 20.4 [pairs] Status: NAD Submitter: Thorsten Ottosen Opened: 2008-05-23 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [pairs].

View all issues with NAD status.

Discussion:

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).

Proposed resolution:

Change the synopsis in 20.2 [utility] to read:

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

Change 20.4 [pairs] to read:

>     namespace std {
>      template <class T1, class T2 = T1>
>      struct pair {
>        typedef T1 first_type;
>        typedef T2 second_type;
>        ...

Rationale:

`std::pair` is a heterogeneous container.