I'm passing a variable std::deque<cv::Point[4]> pastpolygons
by reference. I'm also passing the C array cv::Point polygon[4]
by reference to the same function. The intention is that the one function may push/pop the array into the deque
of arrays as needed. I've written the code how I think it should work ( is there any other way to write code? ) and the compile errors are pretty verbose and hard to understand (it's several pages).
Here's the code:
void AveragePolygon ( cv::Point (*polygon)[4], std::deque<cv::Point[4]> *pastpolygons, int samplestokeep )
{
//FIFO
pastpolygons->push_back( *polygon ); //comment and compiles fine
if ( pastpolygons->size() > samplestokeep ) {
pastpolygons->pop_front(); //comment and compiles fine
}
return;
}
The parameter and argument syntax was particularly tricky, but it compiles so long as I don't try to call the modifiers of pastpolygons
. I've also tried (*pastpolygons).push_back/pop_front
instead, to no avail. Any ideas?
Also, the first bit of the compile errors:
C:/MinGW64/x86_64-w64-mingw32/include/c++/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = cv::Point_<int> [4]; _Args = {const cv::Point_<int> (&)[4]}; _Tp = cv::Point_<int> [4]]': C:/MinGW64/x86_64-w64-mingw32/include/c++/bits/alloc_traits.h:256:4: required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = cv::Point_<int> [4]; _Args = {const cv::Point_<int> (&)[4]}; _Alloc = std::allocator<cv::Point_<int> [4]>; std::_Require<typename s
Aucun commentaire:
Enregistrer un commentaire