Код: Выделить всё
template
struct MyStruct
{
};
auto getMyStruct()
{
static MyStruct one;
static MyStruct two;
if constexpr ((1103515245U ^ 0x1103515245) > 0x0041389155)
return &one;
else
return &two;
}
int main(int argc, char* argv[])
{
auto* p = getMyStruct();
decltype(*p); // DECLTYPE WILL ALWAYS BE REF
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... o-the-type
Мобильная версия