How to display the contents of a std::multimap and

2019-06-17 02:22发布

I am trying to inspect the contents of a std::multimap and std::multiset in the Locals and Expressions window of the QtCreator.

Instead of a list of values I get the implementation details displayed.

The strange thing is that the std::map and std::set counterparts are shown fine:

#include <iostream>
#include <map>
#include <set>
#include <string>

int main()
{
    std::multimap<int, std::string> multimap;
    multimap.insert(std::make_pair(1, "one"));
    multimap.insert(std::make_pair(2, "two"));
    multimap.insert(std::make_pair(3, "three"));

    std::multiset<int> multiset = {1,2,3};

    std::map<int, std::string> map;
    map.insert(std::make_pair(1, "one"));
    map.insert(std::make_pair(2, "two"));
    map.insert(std::make_pair(3, "three"));

    std::set<int> set = {1,2,3};

    return 0;
}

enter image description here

I am using:

Qt Creator 3.0.0 
gcc 4.8
GDB 7.6.1
Qt 5.2.0
Ubuntu 13.10

Is this feature supported?

2条回答
小情绪 Triste *
2楼-- · 2019-06-17 02:35

In addition to installing Python libstdc++ printers from https://sourceware.org/gdb/wiki/STLSupport you should also fix them for Ubuntu 13.10.

You should apply this patch http://patchwork.ozlabs.org/patch/287368/ to make them work. See also this answer https://stackoverflow.com/a/21020798/72178.

查看更多
淡お忘
3楼-- · 2019-06-17 02:40
登录 后发表回答