I'm trying to compile something like this:
#include <list>
class thread
{
public:
static volatile std::list<thread *> threadList; //This is also protected by a mutex
};
volatile std::list<thread *> thread::threadList;
void main()
{
thread A;
thread::threadList.push_back(&A);
thread::threadList.remove(&A);
}
I get these errors when trying to compile:
test.cpp(14): error C2663: 'std::list::push_back' : 2 overloads have no legal conversion for 'this' pointer
with
[
_Ty=thread *
]
test.cpp(15): error C2662: 'std::list::remove' : cannot convert 'this' pointer from 'volatile std::list' to 'std::list &'
with
[
_Ty=thread *
]
Conversion loses qualifiers
What am I doing wrong?
EDIT: fixed some formatting errors with < and >
EDIT2: threadList is protected by a mutex, I just didn't put it here for simplicity