Код: Выделить всё
template
constexpr auto type_from_size() {
if(n < 256) {
return uint8_t;
} else {
return uint16_t;
}
}
template
class X {
type_from_size() t;
}
X x;
x.t = 500;
Подробнее здесь: https://stackoverflow.com/questions/374 ... in-a-templ
Мобильная версия