| 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
}Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.