ниже - код, использующий Cppinsights: < /p>
Код: Выделить всё
#include
template
struct Rank
{
inline static constexpr const size_t value = 0;
};
/* First instantiated from: insights.cpp:13 */
#ifdef INSIGHTS_USE_TEMPLATE
template
struct Rank
{
inline static constexpr const size_t value = 1U + Rank::value;
};
#endif
/* First instantiated from: insights.cpp:13 */
#ifdef INSIGHTS_USE_TEMPLATE
template
struct Rank
{
inline static constexpr const size_t value = 1U + Rank::value;
};
#endif
/* First instantiated from: insights.cpp:13 */
#ifdef INSIGHTS_USE_TEMPLATE
template
struct Rank
{
inline static constexpr const size_t value = 0;
};
#endif
/* First instantiated from: insights.cpp:18 */
#ifdef INSIGHTS_USE_TEMPLATE
template
struct Rank
{
inline static constexpr const size_t value = 1U + Rank::value;
};
#endif
template
struct Rank
{
inline static constexpr const size_t value = 1U + Rank::value;
};
int main()
{
/* PASSED: static_assert(Rank::value == 3); */
return 0;
}
n и n как 3 ниже.
Код: Выделить всё
template
struct Rank
{
inline static constexpr const size_t value = 1U + Rank::value;
};
< /code>
Для меня это больше похоже на строковое регулярное выражение, что делает сигнатура шаблона - первоначальное объявление было: < /p>
template
struct Rank
{
static constexpr size_t value = 1U + Rank::value;
};
Код: Выделить всё
struct Rank
{
inline static constexpr const size_t value = 1U + Rank::value;
};
Подробнее здесь: https://stackoverflow.com/questions/795 ... lates-work