Код: Выделить всё
struct A { A(/* ... */) {} A(A const&) = delete; };
struct B { B(/* ... */) {} B(B const&) = delete; };
int main()
{
static bool constexpr cond = false;
[[maybe_unused]]
A a(/* ... */);
[[maybe_unused]]
B b(/* ... */);
std::conditional_t c = cond ? a : b;
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/785 ... rtain-type