dimanche 16 février 2020

Problem with declaring a protected pointer to a vector

I'm trying to declare a pointer to a std::vector<int> in a derived class in C++. That class is a base class for other classes again.

My attempt was as follows

protected:
   std::vector<CustomClass> *mypointer;

However, when I compile it, I get the following error:

error: no match for ‘operator=’ (operand types are ‘std::vector<int>’ and ‘std::vector<int>*’)
error: no match for ‘operator*’ (operand type is ‘std::vector<int>’)

and some other operands are missing.

I'm pretty clueless, where the problem lies at all. Do I have to implement all those functions in the current class? If so, why do I have to do so?

For anyone needing more context, I want to implement that pointer in the class CbmStsSensor (found here), which derives from CbmStsElement.

Edit: Some relevant classes can be found here CbmStsElement.h and here enter link description here.

Edit2: The whole compilation error log can be found here.

Aucun commentaire:

Enregistrer un commentaire