user1618465
user1618465

Reputation: 1941

Class type error C++ with struct

I've been trying to fix this error for hours but there is something I'm missing:

I have a structure declared as:

typedef struct {
    bool active;
    unsigned long bbcount;
    char buffer[BUFFSIZE];
    std::set<__uint> *bblist;
} per_thread_t;

Later I'm allocating memory for it and setting some variables including the set like this:

per_thread_t *data = (per_thread_t *)malloc(sizeof(per_thread_t));
data->active = false;
data->bblist = new std::set<__uint>();  
data->bblist.find(6328);

But I am getting the error error C2228: left of '.find' must have class/struct/union.

What am I doing wrong here?

Thank you

Upvotes: 0

Views: 52

Answers (1)

derekerdmann
derekerdmann

Reputation: 18252

bblist is a pointer type. You need to access it like this:

data->bblist->find(6328);

Upvotes: 4

Related Questions