none
Display or alter map element in Immediate Iindow RRS feed

  • Question

  • I have
         unordered_map<char,int>  decoder;
    which has ten elements.  I also have an iterator for this map that is set with
         it = decoder.begin();

    If I enter ?decoder in the window, it displays all ten elements.  If I enter ?it is displays the first element ('K',7).  I can display and alter it->fist and it->second.  But it I try to display decode['K'],  I receive
         no operator "[]" matches these operands
    I receive a similar message with it++.  Attempting it=decoder.find('M'), an existing element, produces
         class "std::unordered_map<char,int,std::hash<char>,std::equal_to<char>,std::allocator<std::pair<char const ,int> > >" has no member "find"
    Using at('M') in place of find produces
         Function std::unordered_map<char,int,std::hash<char>,std::equal_to<char>,std::allocator<std::pair<char const ,int> > >::at has no address,
         possibly due to compiler optimizations.

    Google didn't seem to find any references to displaying map elements.  Is there a way?    

    Thursday, June 4, 2020 3:02 AM

All replies