#include <iostream>
template <typename Derived>
struct CRTP {
static constexpr int num() { return Derived::value + 1; }
};
struct A : CRTP<A> {
static constexpr int value = 5;
};
int main()
{
std::cout << A::num();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPHR5cGVuYW1lIERlcml2ZWQ+CnN0cnVjdCBDUlRQIHsKICAgIHN0YXRpYyBjb25zdGV4cHIgaW50IG51bSgpIHsgcmV0dXJuICBEZXJpdmVkOjp2YWx1ZSArIDE7IH0KfTsKCnN0cnVjdCBBIDogQ1JUUDxBPiB7CiAgICBzdGF0aWMgY29uc3RleHByIGludCB2YWx1ZSA9IDU7Cn07CgppbnQgbWFpbigpCnsKCXN0ZDo6Y291dCA8PCBBOjpudW0oKTsKCXJldHVybiAwOwp9