# std::get_pointer_safety

< cpp‎ | memory

定义于头文件 `<memory>` |  |
std::pointer_safety get_pointer_safety() noexcept; |  | (C++11 起) (C++23 中移除)

获得实现定义的指针安全模式，它是 std::pointer_safety 类型的值。

### 参数

（无）

### 返回值

此实现所用的 pointer_safety 。

### 示例

    #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;
        }
    }

可能的输出：

    Pointer safety: relaxed

### 参阅

pointer_safety (C++11)(C++23 中移除) | 列出指针安全模式 (枚举)