c++ - 类类型错误 C++ with struct

标签 c++ struct set std

几个小时以来我一直在尝试修复这个错误,但我遗漏了一些东西:

我有一个结构声明为:

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

稍后我为它分配内存并设置一些变量,包括像这样的 set:

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);

但我收到错误error C2228: left of '.find' must have class/struct/union

我在这里做错了什么?

谢谢

最佳答案

bblist 是指针类型。您需要像这样访问它:

data->bblist->find(6328);

关于c++ - 类类型错误 C++ with struct,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36228103/

相关文章:

c++ - 如何从字符中检索整数值?

c++ - 如何在 MPI_Send 中发送一个集合对象

ruby - 在一次操作中从 Ruby Set 中获取和删除元素

c - 如何使用 while 循环遍历二叉树?

python - 如何使用 python 结构将结构打包到结构中?

c++ - 将派生类实例插入到 std::set

c++ - 旋转纹理 sfml 并将输出保存到文件

php - 在PHP扩展中,推荐的方法从and std::string返回值

c++ - OpenCV 将仿射变换应用于单个点而不是整个图像

C++ 结构体 vector ,为什么我不能使用 vector .at(i) 或 vector [i] 作为结构体?