#include <cstdio>
#include <vector>
template<int n>
struct A
{
static const auto value = A<n - 1>::value + n;
};
template<>
struct A<1>
{
static const auto value = 1;
};
{
printf("c=%c\n", A<5>::value);
}
Here is the transformed code:
#include <cstdio>
#include <vector>
template<int n>
struct A
{
static const auto value = A<n - 1>::value + n;
};
#ifdef INSIGHTS_USE_TEMPLATE
template<>
struct A<4>
{
static const int value = A<3>::value + 4;
};
#endif
#ifdef INSIGHTS_USE_TEMPLATE
template<>
struct A<3>
{
static const int value = A<2>::value + 3;
};
#endif
#ifdef INSIGHTS_USE_TEMPLATE
template<>
struct A<2>
{
static const int value = A<1>::value + 2;
};
#endif
#ifdef INSIGHTS_USE_TEMPLATE
template<>
struct A<5>
{
static const int value = A<4>::value + 5;
};
#endif
template<>
struct A<1>
{
static const int value = 1;
};
{
printf("c=%c\n", A<5>::value);
return 0;
}
Live view