在Visual Studio 2019中输出可能失败的typedef的完整类型

问题描述

我正在尝试在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;
}

还有here is a godbolt

在此示例中,我想在某处看到输出

  1. int ”表示现有的专业化知识
  2. float&”缺少专业化提示
  3. short&”或“ short int&

解决方法

如果我将鼠标光标放在test不完整的对象上,我可以看到作为模板参数传递的类型,请参见图片,它不是很干净,但这是我到目前为止发现的唯一方法。 / p>

enter image description here