samedi 13 juillet 2019

How to return a vector of structs of a function in c++

I am trying to return a vector of structs from my class, but am getting a few errors. This is what i have setup so far:

class trial{

   public:
    struct coords{
      double x,y,z;
    }
    vector<coords> trial::function(vector <double> x1, vector <double> x2);
};

std:vector<coords> function(vector <double> x1, vector <double> x2){

    some math.....
    vector <coords> test;
    return test;
}

The error comes at the st::vector.... saying coords was not defined. Any thoughts?

Aucun commentaire:

Enregistrer un commentaire