我的简单代码如下:

#include <iostream>
#include <atomic>
#include <memory>

int main(void) {
    std::shared_ptr<int> p = std::make_shared<int>(5);
    std::cout << std::boolalpha << std::atomic_is_lock_free(&p) << std::endl;
    return 0;
}

但编译错误:

a.cpp:在函数'int main()'中:a.cpp:7:60:错误:没有匹配函数用于调用'atomic_is_lock_free(std :: shared_ptr *)'std :: cout << std :: boolalpha << std :: atomic_is_lock_free(&p)<< std :: endl; ^ a.cpp:7:60:注意:候选人是:在a.cpp中包含的文件:2:0:/ usr / include / c /4.8.2/atomic:804:5:注意:模板bool std :: atomic_is_lock_free(const std :: atomic <_ITp> *)atomic_is_lock_free(const atomic <_ITp> * __a)noexcept ^ / usr / include / c /4.8.2/atomic:804:5:注意:模板参数扣除/替换失败: a.cpp:7:60:注意:'std :: shared_ptr'不是来自'const std :: atomic <_ITp>'std :: cout << std :: boolalpha << std :: atomic_is_lock_free(&p)< <std :: endl; ^在a.cpp中包含的文件中:2:0:/ usr / include / c /4.8.2/atomic:809:5:注意:模板bool std :: atomic_is_lock_free(const volatile std :: atomic <_ITp> *) atomic_is_lock_free(const volatile atomic <_ITp> * __a)noexcept ^ / usr / include / c /4.8.2/atomic:809:5:注意:模板参数推断/替换失败:a.cpp:7:60:注意:' std :: shared_ptr'不是来自'const volatile std :: atomic <_ITp>'std :: cout << std :: boolalpha << std :: atomic_is_lock_free(&p)<< std :: endl;

没有 template <class T> bool atomic_is_lock_free( const std::shared_ptr<T>* p ); 重载 . 正如here所说,有 . 我的代码一定有错误,有人可以帮帮我吗?谢谢!