我查看了这个出色的答案,但不知道如何将其应用于此剪辑:
//this is in the .hpp file
std::atomic<int> size = 10;
std::recursive_mutex *locks[2];
//in some function of the class
//it's important that the 2nd array dimension is dynamic
the_lock[0] = new std::recursive_mutex[size];
the_lock[1] = new std::recursive_mutex[size];
std::recursive_mutex (*locks_2)[2][size] = &locks;
任务给了我
error: cannot convert ‘std::recursive_mutex* (*)[2]’ to ‘std::recursive_mutex (*)
[2][(((sizetype)(((ssizetype)((**here be long type information, since I'm using
templates a lot**, long unsigned int, std::less<long unsigned int>
>::size.std::atomic<long unsigned
int>::<anonymous>.std::__atomic_base<_IntTp>::operator
std::__atomic_base<_IntTp>::__int_type<long unsigned int>()) + -1)) + 1)]’ in
initialization
如何获得指向“锁”的指针?