How to correctly initialize member variable of template type?

Like so:

T a{};

Pre-C++11, this was the simplest approximation:

T a = T();

But it requires T be copyable (though the copy is certainly going to be elided).

Leave a Comment