简体   繁体   中英

How to see C++ template parameters while debugging with Visual Studio?

I found out that compile-time values are not that easy to see while debugging with Visual Studio.

Suppose that my program just stopped at some breakpoint in some instantiated function template .

There are expressions I want to examine

  1. Template parameters (both type and non-type) associated with current instantiation of template

  2. constexpr variables (which can be dependent of template parameters)

  3. locally declared types with using (which also can be dependent of)

'Watch' and 'Immediate' windows don't seem to support those.

How can I examine those expressions without modifying the code?

I don't have an answer for points 2) and 3), but the value of the template parameters shows up in the Call Stack in VS 2019.

屏幕截图显示了在模板化函数中断点的示例代码,调用堆栈显示了类型和值模板参数的值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM