deductiongu...forstd::pair(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

okay bestie, you're looking at the deductiongu...forstd::pair(3) page from the C++ Standard Libary manual, and it's lowkey iconic ✨

πŸŽ€ NAME πŸŽ€

deductionguidesforstd::pair β€” deductionguidesforstd::pair (yes, it's literally the same thing twice, that's the manpage vibe πŸ’€)

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <utility> β€” don't forget that part, bestie 🫢

template<class T1, class T2>   (since C++17)
pair(T1, T2) -> pair<T1, T2>;

So there's exactly one deduction guide provided for std::pair, and it's there to account for the edge cases missed by the implicit deduction guides β€” in particular, non-copyable arguments and array to pointer conversion. periodt πŸ’…

🌈 Example 🌈

// Run this code

#include <utility>

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

That's the whole flex: std::pair p{a, b}; and the explicit deduction guide is used in this case, fr fr πŸ¦‹


okay that's the page, bestie β€” mwah πŸ’‹ source/version: http://cppreference.com, date: 2024.06.10.

πŸ“¦ where this page comes from