开发者

How to print the return type of a function in Visual Studio 2008 (C++)?

Imagine you 开发者_开发技巧have a function, if you hover over it with the mouse in visual studio you'll get the function prototype. Is it possible to print to the screen the return type of this function ?

This is a practical question, not a programming one. Does the functionality exist in VS ?


I don't know a direct way, but here's a workaround that is relatively easy.

  1. Right click on the function name.
  2. Choose either "Go to definition" or "Go to declaration".
  3. Select/copy the return type using standard copy/paste features.


Why would you want to do this? Is this function a template and you don't know its return type at runtime?

template <typename T>
T dostuff () 
{
    //does stuff
    cout << typeid(T).name();
    return T;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜