mercredi 22 mai 2019

Initialising template variables using initializer list

I looked at a piece of code and I am trying to understand how it works and so here is a minimal working example

template <typename T>
class A
{
public:
    A() : _mem(T()) {};
private:
    T   _mem;
};

The first thing I was not exactly clear about is the initialisation of _mem in the initialiser list. What is this technique(?) called? If I look in the debugger _mem is set to 0. If there is a c++11 way to do the same thing could I receive some comments on that?

Aucun commentaire:

Enregistrer un commentaire