How to display as string a member variable in a struct/class when the mouse hovers on variable?

Manda Rajo 141 Reputation points
2022-07-25T12:12:09.61+00:00

That question was always in my head for a very long time, for examples how to turn:

  • type=1 into "one".
  • type=2 into "two".
  • type=3 into "three".
  • Member variable with type vec2 into "{x, y}".
  • Member variable with type vec3 into "{x, y, z}".
  • Member variable with type vec4 into "{x, y, z, w}".
  • etc.

I use VSCode with the compiler from Visual Studio 2015:
224369-type.jpg
Note: I cannot use enum because I downloaded source codes from professional developers and they don't use enum, they just use int.

The reason I don't store the string display in a separate member variable is for performance reason, and the variable can be changed at any time but I can forgot to update the string, it's always better to have simple codes as possible for fast development as possible.

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
{count} votes

1 answer

Sort by: Most helpful
  1. Guido Franzke 2,191 Reputation points
    2022-07-25T12:32:33.643+00:00

    Sorry,
    but with your restrictions, it is impossible.
    Regards, Guido

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.