gpt4 book ai didi

c++ - 使用 SFINAE 的 C++ 中的可移植 typeof()?

转载 作者:太空宇宙 更新时间:2023-11-04 15:27:06 27 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Absence of typeof operator in C++03?

是否可以在 C++0x 之前的 C++ 中使用模板可移植获取表达式的编译时类型?

类似于:

int foo() { return 0; } //Let's say we have this
typeof(foo()) x; //x would now be of type 'int'

但由于我们使用的是模板,因此显然可能需要稍微不同的语法。

(我在这里和网络上的其他地方看到了很多重复项,但它们似乎依赖于特定于编译器的功能或 C++0x(C++11?)decltype 功能.)

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com