我想在map函數內聲明n個struct數組。代碼片段如下,當我嘗試執行m_channelInfo [destination] = newdata [chNum]時,它向我發出錯誤信息。和錯誤是, 「無操作符匹配」=「操作數」我很困惑如何解決這個問題,或者我不能使用結構獨立映射函數數組。請建議。std :: map <x,y>:如何在map函數內聲明struct(y)數組
chNum=10;
struct Record
{
int pkt;
double frameErrorRate;
double ProbabilityVector;
};
void ChannelUsageData (Mac48Address destination, Mac48Address retransmitter)
{
std::map<Mac48Address, Record>::iterator i = m_channelInfo.find (destination);
if (i == m_channelInfo.end())
{
Record newdata[chNum];
// std::vector<Record> newdata;
//Record newdata;
m_channelInfo[destination] = newdata;
}
i = m_channelInfo.find (destination);
NS_ASSERT (i != m_channelInfo.end());
}
顯示的'Mac48Address' –