I have a
volatile std::queue<int> requestQueue;
and when I try to call within a function any of its methods (pop, push, empty, front etc), e.g.:
while (!requestQueue.empty()){
...do something
}
I get the following error.
robot.cpp:43:31: error: passing 'volatile std::queue<int>' as 'this'
argument of 'bool std::queue<_Tp, _Sequence>::empty()
const [with _Tp = int, _Sequence = std::deque<int, std::allocator<int> >]'
discards qualifiers [-fpermissive]
I found online that a typecast might be needed, but I am not sure whether this is the case.
Any ideas? Thanks in advance.
Update
1) The program uses such a data structure to store a sequence of requests so that a server can take the requests at its own service rate.
2) volatile is used to support data sharing between functions running on different cores.
3) The documentation of the library I use states the following regarding the use of
- Use static volatile to declare global variables for sharing between functions running in different cores.