how to figure out the type of template parameters using VS Debugger?

I am dealing with the heavily templated code and now need to figure out the type of template parameters.

In the following code that I simplified, How could you debug to find out what type each T is depending on main() that will initiate the A with int, double, or any other type.

template <class T>
class A // 1
{
public:
    typedef T Type;
};

template <class T>
class A<T*> // 2
{
public:
    typedef T Type;
};

template <class T> 
class A<T**> // 3
{
pbulic:
    typedef T Type;
};

I tried using Watch window but I don't think it can help me know what T's actual type is.

If T is int*, It will be the best for me to see the code in a instatiation form of the templated code that is something that goes like;

 class A // 1
 {
  public:
    typedef int* Type;
 };

Thanks in advance.

Answers


Maybe I am misunderstanding what you want, but (even in creaky old MSVS 2003) the Watch (or Auto) window does this nicely for me via the "Type" column:

Note that within a program T could take many different types for different instantiations (e.g. I have three just in my little program in the picture), so it doesn't make sense to ask what type T is outside the context of a specific instantiation.

If you are stepping through a method of a templated class, as well as checking the type of this in the Watch window, you can see it in the call stack:


Need Your Help

Insert Data Into Temp Table with Query

sql sql-server ssms

I have an existing query that outputs current data, and I would like to insert it into a Temp table, but am having some issues doing so. Would anybody have some insight on how to do this?

How to test if SQL Server database is in Single User Mode

sql-server

How can I test if the SQL Server database is in Single User Mode in a SQL script?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.