deduction guides for std::pair - cppreference.com (original) (raw)
| Member functions |
|---|
| pair::pair |
| pair::operator= |
| pair::swap(C++11) |
| Non-member functions |
| make_pair |
| operator==operator!=operator<operator<=operator>operator>=operator<=>(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20) |
| swap(std::pair)(C++11) |
| get(std::pair)(C++11) |
| Helper classes |
| tuple_sizestd::pair(C++11) |
| tuple_elementstd::pair(C++11) |
| basic_common_referencestd::pair(C++23) |
| common_typestd::pair(C++23) |
| formatterstd::pair(C++23) |
| piecewise_construct_t(C++11) |
| Deduction guides(C++17) |
| Defined in header | | | | ----------------------------------------------------------------------------- | | ------------- | | 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.
[edit] Example
Run this code
#include int main() { int a[2], b[3]; std::pair p{a, b}; // explicit deduction guide is used in this case }