모두! 맵 컨테이너에 채널 데이터 그룹을 유지합니다. 개별 채널 데이터는 해당 채널 이름으로 액세스 할 수 있습니다. 이와 관련하여 간단한 함수 GetIRChannelData
을 작성합니다 (다음 코드 참조). compliing 때, 문 pusIRChannelData = cit->second();
는 할오류 C2064 : 용어가 0 개의 인수를 취하는 함수로 평가되지 않습니다.
error C2064: term does not evaluate to a function taking 0 arguments
모든 기능을 읽을 오류가지도 컨테이너에 주어진 채널 이름/ID를 검색하고, 시간적 포인터 그것을 데이터 포인터를 할당하는에 불과하다 throwed 발견되면. 뭐가 잘못 됐는지 보여 주시겠습니까?
const Array2D<unsigned short>* GetIRChannelData(std::string sChannelName) const
{
const Array2D<unsigned short>* pusIRChannelData = NULL;
for (std::map<std::string, Array2D<unsigned short>* >::const_iterator cit = m_usIRDataPool.begin(); cit != m_usIRDataPool.end(); ++cit)
{
std::string sKey = cit->first;
if (sKey == sChannelName)
{
pusIRChannelData = cit->second(); // Error occurred on this line
break;
}
}
return pusIRChannelData;
}
키를 찾는 모든 요소를 루핑하는 대신'std :: map'의'find' 메소드를 사용하지 않는 특별한 이유가 있습니까? –
부수적으로 별칭은 코드를보다 읽기 쉽게 만드는 데 정말로 도움이됩니다.'typedef std :: map <...> DataPool; (DataPool :: const_iterator ...'. –