Jump to content
  • Advertisement
Sign in to follow this  
USA_NAAL

Viewing a C++ generated template code?

This topic is 4068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there is any mean in which we can view the generated template of a given class using visual studio or any external tool or any other compiler (under Windows). for example we all know the vector template template<class _Ty, class _Ax> class vector : public _Vector_val<_Ty, _Ax> { ... } then i declare a variable like vector<int> vec1; the thing is i want to see a copy of the generated class were all the template parameters are replaced with the specified data types in our example the _Ty parameter gets replaced by the int data type I need this because it is too hard to know the real problem when writing a template and possibly miss something.

Share this post


Link to post
Share on other sites
Advertisement
A number of different compile errors tend to give you a great big long string with what parameters it has filled the template in with. It wont give you the whole code though.

Share this post


Link to post
Share on other sites
Perhaps this is what you are looking for - you can force the compiler to generate and compile all functions in the class template for a particular type - search for "explicit template instantiation", which can be helpful for finding compile errors lurking in your template code that don't show up until you first use particular functions.

As for getting an expanded version of the template source, I dont think you can easily do that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!