나는 사용자가 폴더에서 .bmp를 선택한 다음 선택한 이미지와 얼마나 유사한 지에 따라 다른 그림을 폴더에 표시하는 프로그램을 만들고 있습니다. 따라서 나는 두 개의 비트 맵을 비교하고 점수winapi에서 람다 함수를 사용하여 벡터 정렬하기
double compareImages(HBITMAP pic1,HBITMAP pic2);
높은에게 더 유사한 두 사진은 점수를 반환하는 함수를 만들었습니다.
는 또한
std::vector<HBITMAP> pictures;
지금 내가 선택한 사진과 비교했을 때 자신의 점수에 따라 벡터의 핸들을 정렬 할 폴더에있는 모든 사진의 인스턴스 핸들을 보유하는 벡터를 만들었습니다 . 높은 점수가 먼저 와야합니다.
||=== Build: Debug in imageComparator (compiler: GNU GCC Compiler) ===|
C:\Users\GS\Desktop\Programy\imageComparator\src\leftWindow.h||In function 'LRESULT WindowProcedureLeft(HWND, UINT, WPARAM, LPARAM)':|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|133|warning: lambda expressions only available with -std=c++11 or -std=gnu++11|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|error: no matching function for call to 'sort(std::vector<HBITMAP__*>::iterator, std::vector<HBITMAP__*>::iterator, WindowProcedureRight(HWND, UINT, WPARAM, LPARAM)::<lambda(HBITMAP__* const&, HBITMAP__* const&)>)'|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|note: candidates are:|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\bits\stl_algo.h|4676|note: template<class _RAIter> void std::sort(_RAIter, _RAIter)|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\bits\stl_algo.h|4676|note: template argument deduction/substitution failed:|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|note: candidate expects 2 arguments, 3 provided|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\bits\stl_algo.h|4705|note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\bits\stl_algo.h|4705|note: template argument deduction/substitution failed:|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|required from here|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|error: template argument for 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' uses local type 'WindowProcedureRight(HWND, UINT, WPARAM, LPARAM)::<lambda(HBITMAP__* const&, HBITMAP__* const&)>'|
C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|error: trying to instantiate 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'|
중요한 비트
아마 인 :C:\Users\GS\Desktop\Programy\imageComparator\src\rightWindow.h|134|error: template argument for 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' uses local type 'WindowProcedureRight(HWND, UINT, WPARAM, LPARAM)::<lambda(HBITMAP__* const&, HBITMAP__* const&)>'|
무엇을 잘못하고
local type 'WindowProcedureRight(HWND, UINT, WPARAM, LPARAM)::<lambda(HBITMAP__* const&, HBITMAP__* const&)>
이 실제로 무엇을 의미 하는가
std::sort(pictures.begin(),pictures.end(),[](const HBITMAP& pic1,const HBITMAP& pic2) -> bool
{
double comp1 = compareImages(pic1,selectedPicture); //the score of pic1
double comp2 = compareImages(pic2,selectedPicture); //the score of pic2
return comp1>comp2;
}
);
오류를 얻기?
'comp1> comp2'는'comp1