从set打印gdb share_ptr

时间:2017-12-06 13:39:22

标签: c++ c++11 gdb

如何打印存储在set中的共享指针的值。   从C ++ set打印gdb share_ptr。

    p field_set
$30 = std::set with 5 elements = {
  [0] = std::shared_ptr (count 2, weak 0) 0x862030,
  [1] = std::shared_ptr (count 2, weak 0) 0x863630,
  [2] = std::shared_ptr (count 2, weak 0) 0x863710,
  [3] = std::shared_ptr (count 2, weak 0) 0x8637f0,
  [4] = std::shared_ptr (count 2, weak 0) 0x8638d0

正如您所见,share_ptr存储在C ++设置值中。 我如何打印价值?

我已经尝试过以下输入,它不起作用:

1.  p *(field_set)._M_ptr 
  //No symbol "driverl" in current context.
2.  p *(field_set[0])._M_ptr
   //No symbol "operator[]" in current context.

0 个答案:

没有答案