johnnycrash
johnnycrash

Reputation: 5344

Get MSVC intellisense to show base type

A lot of times, I do something like this:

template <int> struct CTypeMap    { typedef int  Type; };
template <>    struct CTypeMap<1> { typedef bool Type; };
template <>    struct CTypeMap<2> { typedef char Type; };

CTypeMap<0>::Type q;

When I hover over q, it would be nice if intellisense showed me Type as "int", "bool", or "char". Instead I get "CTypeMap<0>::Type"

Are there any ways to trick intellisense into doing something like this?

Upvotes: 0

Views: 60

Answers (1)

James McNellis
James McNellis

Reputation: 355049

To the best of my knowledge, there is no way to get IntelliSense to show this in Visual Studio 2013.

However, in Visual Studio 2015, IntelliSense will report that q is of type int instead of CTypeMap<0>::Type, which is what you want. This was one of many small tweaks that were made to the IntelliSense help tooltips for Visual Studio 2015. (My favorite tweak involves the collapsing of typedefs, e.g. for std::vector<std::string>.)

Upvotes: 1

Related Questions