vendredi 25 juin 2021

unable to create 2d matrix inside a class

The error is : "member matrix::rows is not a type name" and "member matrix::init is not a type name". If it compiles successfully I shall have a matrix rows = ROWS and columns = COLS. What am i doing wrong here:

#include <vector>
class matrix
{
    int ROWS{}, COLS{}, init{-1};
    std::vector<std::vector<int>> table(ROWS, std::vector<int>(COLS, init));
};

Aucun commentaire:

Enregistrer un commentaire