Fill QMap using qFill



  • Hi. How can we fill a QMap using qFill()? How are we supposed to supply the values to be filled?


  • Moderators

    easiest way:
    @
    QMap<...> map;
    qFill(map, val);
    @

    Make sure that your container class (QMap in this case) has already inserted/allocated.



  • Sorry for the late reply, but how exactly are we supposed to provide the value? Is it a QMap object? I will be helpful if you could provide a code snippet.


  • Moderators

    for example:
    @
    QMap<int,int> map;
    map.insert(0, 1);
    ...
    qFill(map, 0);
    @

    in case of QMap - and other containers which do not preallocate items - this only works on already inserted items.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.