2011-08-31 74 views
2

我有以下代码...怎么看的提升值:在调试模式下unordered_map与VS2010

typedef boost::unordered_map<int, boost::unordered_map<int, float>* > User_item_rating_map; 

正如你所看到的,图的值是一个指针。我怎样才能得到地图中的价值。如果我使用(*(ret[int]))[int],我似乎无法获得价值。我究竟做错了什么?

回答

4

文件AUTOEXP.DAT是告诉Visual Studio如何在调试器中表示数据结构的文件。

,一些描述可以说是相当容易的,像这一个的CSize:

CSize =cx=<cx> cy=<cy> 

但他们也可以很复杂,像这样的一个位集:

std::bitset<*>{ 
    preview 
    (
     #(
     "[", 
      $c.digits, 
     "](", 
     #array 
     (
      expr : ($c._Array[$i/$c._Bitsperword] >> ($i % $c._Bitsperword)), 
      size : $c.digits 
     ) : [($e & 1),d], 
     ")" 
     ) 
    ) 
    children 
    (
     #array 
     (
      expr : ($c._Array[$i/$c._Bitsperword] >> ($i % $c._Bitsperword)), 
      size : $c.digits 
     ) : (bool)($e & 1)) 
} 

你可以编写你自己的描述为boost unordered_map,或者可能有其他人已经为你做了。看看https://svn.boost.org/trac/boost/ticket/4209(这似乎是你需要的东西)。

1

我有同样的麻烦,去看看建议修复从Boost Ticket #4209工作,没有。我可以看到元素的总数,但看不到内容。

因此,可以选择切换到VS2012,其中有Plug-In,或者投资搞清楚VS2010中的格式并修复现有的建议代码。

或者,这就是我所做的,而是使用std :: tr1 :: unordered_set/map。 Visual Studio中有一个可视化工具。然后,在调试之后,如果您愿意,请切换回升压。

0

用文本编辑器打开文件autoexp.dat。 你通常会发现它在:

C:\ Program Files文件\微软的Visual Studio 10.0 \ Common7 \包\调试\ autoexp.dat

下面的代码添加到部分[展示台]。这个代码应该在另一个可视化器的定义之后添加。

;------------------------------------------------------------------------------ 
; boost unordered collections 
;------------------------------------------------------------------------------ 
boost::unordered::unordered_map<*,*,*,*,*>{ 
    preview (
    #(
     "[", 
     $e.table_.size_, 
     "](", 
     #list(
      head: $e.table_.buckets_[$e.table_.bucket_count_].next_, 
      size: $e.table_.size_, 
      next: next_ 
     ) : #(*((std::pair<$T1 const ,$T2>*)&(*(boost::unordered::detail::ptr_node<std::pair<$T1 const ,$T2> > *)(&$e)).value_base_)), 
     ")" 
    )) 
    children(
    #(
     size: ($e.table_.size_), 
     #list(
      head: $e.table_.buckets_[$e.table_.bucket_count_].next_, 
      size: $e.table_.size_, 
      next: next_ 
     ) : #(*((std::pair<$T1 const ,$T2>*)&(*(boost::unordered::detail::ptr_node<std::pair<$T1 const ,$T2> > *)(&$e)).value_base_)), 
    )) 
} 


boost::unordered::unordered_set<*,*,*,*>{ 
    preview (
    #(
     "[", 
     $e.table_.size_, 
     "](", 
     #list(
      head: $e.table_.buckets_[$e.table_.bucket_count_].next_, 
      size: $e.table_.size_, 
      next: next_ 
     ) : #(*(($T1*)&((*(boost::unordered::detail::ptr_node<$T1>*)(&$e)).value_base_))), 
     ")" 
    )) 
    children(
    #(
     size: ($e.table_.size_), 
     #list(
      head: $e.table_.buckets_[$e.table_.bucket_count_].next_, 
      size: $e.table_.size_, 
      next: next_ 
     ) : #(*(($T1*)&((*(boost::unordered::detail::ptr_node<$T1>*)(&$e)).value_base_))), 
    )) 
} 

比如我已经排

;------------------------------------------------------------------------------ 
; std::plus, etc. from <functional> 
;------------------------------------------------------------------------------ 

你的下一个调试会话它应该工作之前添加它。

我用Microsoft Visual Studio 2010 10.0.40219.1 SP1Rel和boost 1.61.0测试了它。