everyone!
I maintain a group of channel data in a map container, from which an individual channel data can be accessed by its channle name. With regards to this, I write a simple function GetIRChannelData (please see the following code). When compliing, the statement pusIRChannelData = cit->second(); throwed an error, which read
error C2064: term does not evaluate to a function taking 0 arguments
All the function to do is nothing but to search for a given channel name/ID in the map container, and assign it data pointer to a temporal pointer if found. Would you please show me what’s wrong?
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;
}
The error message is pretty clear… you call a function that doesn’t exist.
map::iteratorpoints to astd::pair, which has two member objects,firstandsecond. Note that these are not functions. Remove the()from the line in question and the error should go away.