deduction guides for std::pair

From cppreference.com
< cpp‎ | utility‎ | pair
 
 
Utilities library
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)
 
std::pair
Member functions
(C++11)
Non-member functions
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
(C++11)
(C++11)
Deduction guides(C++17)
Helper classes
(C++11)
 
Defined in header <utility>
template<class T1, class T2>
pair(T1, T2) -> pair<T1, T2>;
(since C++17)

One deduction guide is provided for std::pair to account for the edge cases missed by the implicit deduction guides.

In particular, non-copyable arguments and array to pointer conversion

Example

#include <utility>
 
int main()
{
    int a[2], b[3];
    std::pair p{a, b}; // explicit deduction guide is used in this case
}