I had to use a fixed size queue, which is limited to 5 elements. Here is a code, in which I tried to encapsulate the implementation.
typedef enum result{SUCCESS = 1,FAILURE = 0} Result;
class VehicleParcelQueue::public std::queue<Parcel&>{
public:
Result push_back(Parcel&){
if (size() >= 5) return FAILURE;
else{
std::queue<Parcel&>::push_back(Parcel&);
return SUCCESS;
}
}
};
from some reason I'm getting the following error:
error: forming pointer to reference type 'Parcel&'
(Parcel is a class I implemented elsewhere)
What am I doing wrong?
thanks
[edit: I looked in the suggested question, but if I change it to:
class VehicleParcelQueue::public std::queue<Parcel*>{
public:
Result push_back(Parcel*){
if (size() >= 5) return FAILURE;
else{
std::queue<Parcel*>::push_back(Parcel*);
return SUCCESS;
}
}
};
I still get the same error.