error: cannot convert ‘std::deque<cv::Mat>*’ to ‘int*’ in initialization int* ptr_share = &depth_queue;
时间: 2024-05-05 10:20:59 浏览: 12
这个错误是因为你试图将一个指向 `std::deque<cv::Mat>` 类型的指针转换为指向 `int` 类型的指针。这是不允许的,因为这两种类型是完全不同的。
要解决这个问题,你需要确定你想要的指针类型,并相应地进行修改。如果你需要一个指向 `std::deque<cv::Mat>` 类型的指针,那么你应该这样做:
```cpp
std::deque<cv::Mat>* ptr_share = ...
```
如果你需要一个指向 `int` 类型的指针,那么你应该这样做:
```cpp
int* ptr_share = ...
```
在两种情况下,你都需要确保指针类型与你要指向的数据类型匹配。
相关问题
std::unique_ptr<ThreadSafeDeque<std::pair<time_t, std::string> > > p_deque_message_怎么优化
这个问题可以回答。std::unique_ptr<ThreadSafeDeque<std::pair<time_t, std::string> > > p_deque_message_可以通过以下方式进行优化:
1. 使用普通指针代替unique_ptr,可以避免unique_ptr的内存管理开销。
2. 使用更高效的数据结构,例如std::vector或std::list,可以提高访问和插入元素的效率。
3. 考虑使用多线程技术,例如锁或无锁队列,以提高并发性能。
4. 考虑使用内存池技术,以减少内存分配和释放的开销。
typedef std::deque<Work_Condition_tag*> Work_Condition_List;
This line of code declares a typedef for a deque container that holds pointers to objects of type "Work_Condition_tag". The new type is called "Work_Condition_List".
A deque is a container that provides constant time insertions and deletions at both its beginning and end. It is similar to a vector in that it is a sequence container, but it allows efficient insertions and deletions at both ends.
The asterisk (*) in "Work_Condition_tag*" indicates that the deque holds pointers to Work_Condition_tag objects, rather than the objects themselves. This allows the deque to hold objects of varying sizes and avoid copying large objects when adding or removing elements.
Overall, this line of code defines a new type that will be used to store a list of pointers to Work_Condition_tag objects using a deque container.