Namespaces
Variants
Actions

deduction guides for std::pair

From cppreference.com
< cpp‎ | utility‎ | pair
 
C++
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
std::pair
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.

[edit] Example

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant