问题描述
我正在尝试在Visual Studio的构建日志中输出typedef的完整类型;即使对于可能失败的typedef,f.e。当缺少部分专业知识时。 我的具体版本是2019,但我也尝试过并在2010和2015年失败。
我可以找到的唯一可能的解决方案是here,但它在Visual Studio中不起作用。
这是测试代码:
template<typename T>
struct Printer;
template <typename T>
struct ST;
template <>
struct ST<int&> {
typedef int T;
};
template <typename T>
struct S {
Printer<typename ST<T>::T> t;
};
int main() {
typedef int& intref;
S<intref> testi;
typedef float& floatref;
S<floatref> testf;
typedef short& shortref;
Printer<shortref> testsi;
}
在此示例中,我想在某处看到输出
- “ int ”表示现有的专业化知识
- “ float&”缺少专业化提示
- “ short&”或“ short int&”