std::get_pointer_safety(3)

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

πŸ’– NAME πŸ’–

okay so bestie, this is the std::get_pointer_safety(3) page from the C++ Standard Library, and the name is exactly std::get_pointer_safety β€” like, the function is literally std::get_pointer_safety. No cap. πŸ’…

✨ Synopsis ✨

First things first: it lives in header <memory>.

Defined in header <memory>
std::pointer_safety get_pointer_safety() noexcept;  (since C++11)
                                                    (removed in C++23)

So it obtains the implementation-defined pointer safety model, which is a value of type std::pointer_safety. That's the whole vibe.

⚠️ And yes, removed in C++23 is right there in the signature. This one is gone in C++23, so clock that. πŸ’€

🌸 Parameters 🌸

(none) β€” literally none, zero, zilch. It takes no arguments, bestie. 🫢

πŸŽ€ Return value πŸŽ€

The pointer safety used by this implementation. That's it. That's the return value. It gives you back the implementation's pointer safety, full stop. ✨

πŸ¦‹ Example πŸ¦‹

The original says // Run this code, so go run it, bestie:

#include <iostream>
#include <memory>

int main()
{
    std::cout << "Pointer safety: ";
    switch (std::get_pointer_safety())
    {
        case std::pointer_safety::strict:
            std::cout << "strict\n";
            break;
        case std::pointer_safety::preferred:
            std::cout << "preferred\n";
            break;
        case std::pointer_safety::relaxed:
            std::cout << "relaxed\n";
            break;
    }
}

Possible output:

Pointer safety: relaxed

🌈 See also 🌈

  • pointer_safety β€” lists pointer safety models; (C++11), (enum), and removed in C++23

That's the whole page, bestie. Signing off from http://cppreference.com with the date stamp 2024.06.10 on std::get_pointer_safety(3) β€” love you, bye! πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from