is there a way to know the compiler instantiated code for a template function or a class in C++
Assume I have the following piece of code
template &l
Now there is an on-line tool which does this for you: https://cppinsights.io/ For example, this code
template auto add(X x, Y y) {
return x + y;
}
int main()
{
return add(10, 2.5);
}
Is translated to
template auto add(X x, Y y) {
return x + y;
}
/* First instantiated from: insights.cpp:9 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
double add(int x, double y)
{
return static_cast(x) + y;
}
#endif
int main()
{
return static_cast(add(10, 2.5));
}