Subject: [Boost-bugs] [Boost C++ Libraries] #10112: improved shared_ptr visualizer and weak_ptr
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-06-11 10:39:45
#10112: improved shared_ptr visualizer and weak_ptr
---------------------------------+---------------------------
Reporter: murray read at ccdc | Owner: matias
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: Documentation
Version: Boost 1.54.0 | Severity: Optimization
Keywords: |
---------------------------------+---------------------------
I was trying out the boost::shared_ptr visualizer for Visual Studio 2010,
here
https://svn.boost.org/svn/boost/sandbox/boost_docs/subprojects/DebuggerVisualizers/shared_ptr.vis.txt
It's ok, but it doesn't show very much. The typical display is:
shared_ptr {...} count = ...
While experimenting with the visualizer, I made several observations:
1) If you view a pointer rather than a dereferenced pointer, you see both
the address (which is useful) and more content in the referenced object
(which is very useful)
2) Our normal use of shared_ptr is as a pointer. The usage count is not
normally something we want to know about. By removing the text formatting,
and only showing the pointer in the preview, we see far more content in
the referenced object (even more useful)
3) The children are displayed in alphabetic order. It's most useful to be
able to see and expand "ptr" in the children. Renaming "count" to
"use_count" puts "ptr" at the top, where it belongs.
4) weak_ptr can be visualized the same way.
An example boost::shared_ptr is now previewed as:
0x18467058 {parent_bond_=0x184546e0 {type_={...} polymeric_=false
annotations_={...} ...} mol_=0x18448768 {m_=0x1246c5ac {impl_={...}
annotations_={...} } impl_={...} proxy_atom_creator_={...} ...}
graphic_properties_=0x00000000 }
{{{
;------------------------------------------------------------------------------
; boost::shared_ptr
;------------------------------------------------------------------------------
boost::shared_ptr<*>{
preview
(
($T1 *)$c.px
)
children
(
#(
ptr: (($T1 *)$c.px) ,
use_count: $c.pn.pi_->use_count_ ,
weak_count: $c.pn.pi_->weak_count_
)
)
}
;------------------------------------------------------------------------------
; boost::weak_ptr
;------------------------------------------------------------------------------
boost::weak_ptr<*>{
preview
(
($T1 *)$c.px
)
children
(
#(
ptr: (($T1 *)$c.px) ,
use_count: $c.pn.pi_->use_count_ ,
weak_count: $c.pn.pi_->weak_count_
)
)
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10112> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC