mercredi 24 février 2016

Using a template to create arrays of varying length inside of class in C++11

Say I have a class:

template <int S1>
class Cont {
    private:
       std::array<int, S1> nums;
    public:
       Cont(std::array<int, S1> ns);
}

When trying to link my program, I am getting an error saying that, for example, Cont(std::array ns) is undefined. So am I doing something wrong? Or will this never work due to how arrays work?

Aucun commentaire:

Enregistrer un commentaire