오류 :
오류 C2678 : 이진 '=='없음 연산자 (용인 변환 또는 존재) 'CONST 항목'형의 왼쪽 피연산자를 필요없는 발견C++ 템플릿 클래스 오차
기능 :
template <class T, int maxSize>
int indexList<T, maxSize>::search(const T& target) const
{
for (int i = 0; i < maxSize; i++)
if (elements[i] == target) //ERROR???
return i; // target found at position i
// target not found
return -1;
}
이 오버로드 된 연산자로 생각되어 있습니까? 템플릿 클래스이므로 오류를 이해할 수 있을지 잘 모르겠습니까?
용액 - 클래스 지금 선언 CONST의 과부하 기능 :
//Operators
bool entry::operator == (const entry& dE) const <--
{
return (name ==dE.name);
}
http://stackoverflow.com/a/38887476/1599699 – Andrew