如果我在 Ubuntu 20.04 系统上的 cppyy v1.6.2 中运行以下测试脚本:
#!/usr/bin/python3
import cppyy
cppyy.cppdef("""
struct Test {
void test() const {
std::cout << std::is_same<int,double>::value << std::endl; // works
std::cout << std::is_same_v<int,double> << std::endl; // doesn't work
}
};
""");
tt = cppyy.gbl.Test()
tt.test()
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
input_line_21:5:21: error: no member named 'is_same_v' in namespace 'std'
std::cout << std::is_same_v<int,double> << std::endl; // doesn't work
~~~~~^
input_line_21:5:34: error: expected '(' for function-style cast or type construction
std::cout << std::is_same_v<int,double> << std::endl; // doesn't work
~~~^
Traceback (most …Run Code Online (Sandbox Code Playgroud)