나는 this excellent answer 보았지만,이에 적용하는 방법을 알아낼 수 없습니다가 냈다 :C++ : 2 차원 동적 배열에 대한 포인터를 얻는 방법?
//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
가 어떻게 '잠금 장치'에 대한 포인터를 얻을 수 있습니까?
는 Arrrr ... 뮤텍스 "잠금"을 호출하지 마십시오. 뮤텍스는 뮤텍스이고 잠금은 잠금입니다. –
죄송합니다. 나는이 책에서 자바 스타일의 의사 코드를 구현하기 위해 노력하고있어 혼란을 – mort
확인을 피하기 위해 이름을 유지하고 - 나는 그 당신에 대해보다 자바에 대한 자세한 내용을 말하는 것 같아요 :-) (. 또는 적어도이 책에 대한) –