c++ - How to fix 'unresolved overloaded function type?' -


this class

class channel {     public:         channel(int channelnumber, channeltype channeltype); }; 

and map

map<int, channel> m_channel(int, channeltype); 

why attempting add channel map this

m_channel[channelnumber] = channel(channelnumber, channeltype); 

cause compile error?

error: invalid types ‘<unresolved overloaded function type>[int]’ array subscript

int seems valid type array subscript.

this line

map<int, channel> m_channel(int, channeltype); 

declares function named m_channel takes int , channeltype , returns map<int, channel>. assume want member variable instead.

map<int, channel> m_channel; 

see https://en.wikipedia.org/wiki/most_vexing_parse


Comments