Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug heavily templated code in c++? [duplicate]

Tags:

I find it very hard to figure out what is wrong with my code when using C++ template meta-programming. It might be that I am just not very good at understanding the error messages, but as far as I'm aware I can't resort to putting in print statements or breakpoints to figure out what's going on.

What tips or advice can you offer when trying to figure out why something is not compiling other than just picking through the code manually and hoping it will come to me?

like image 613
Dan Avatar asked Feb 18 '09 23:02

Dan


1 Answers

For the STL at least there are tools available that will output more human-friendly error messages. See http://www.bdsoft.com/tools/stlfilt.html

For non-STL templates you'll just have to learn what the errors mean. After you've seen them a dozen times it becomes easier to guess what the problem is. If you post them here maybe somebody can help you figure it out.

like image 147
Michel Avatar answered Oct 10 '22 05:10

Michel