class Scheduler:public Kolejka
{
private:
unsigned long real_time;
Scheduler(void) :real_time(0L){}
Scheduler(const Scheduler &);
Scheduler& operator=(const Scheduler&);
~Scheduler() {}
public:
std::deque <Kolejka*> kolejka;
//... rest of methods, not important here
static Scheduler& getInstance()
{
unsigned long tmptime = 1;
for (int i = 0; i < 10; i++)
{
Kolejka* tmp = new Kolejka(tmptime + 1);
kolejka.push_back(tmp); //error C2228: left of '.push_back' must
//have class/struct/union
//IntelliSense: a nonstatic member reference must be relative
//to a specific object
tmptime++;
delete tmp;
}
static Scheduler instance;
return instance;
}
};
The problem is written in code, i understand that i should do it the other way, but how? I'm asking for a little help :) I don't know how to get rid of this problem, i tried without pointers, but problem was the same.
edit: i solved it this way:
void setscheduler()
{
unsigned long tmptime = 1;
for (int i = 0; i < 10; i++)
{
Kolejka * tmp = new Kolejka(tmptime + 1);
kolejka.push_back(tmp);
tmptime++;
}
}
static Scheduler& getInstance()
{
static Scheduler instance;
return instance;
}
};
and i just make an empty deque, filling it a little bit later by
Scheduler::getInstance().setscheduler();