Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4209: Visualizer VS 2008 to boost::unordered_map
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-03 16:42:46
#4209: Visualizer VS 2008 to boost::unordered_map
------------------------------------+---------------------------------------
Reporter: fernandoofj@⦠| Owner: danieljames
Type: Feature Requests | Status: closed
Milestone: To Be Determined | Component: unordered
Version: Boost 1.42.0 | Severity: Cosmetic
Resolution: wontfix | Keywords:
------------------------------------+---------------------------------------
Comment (by brian.ventre@â¦):
I started looking at this yesterday, and haven't gotten very far, but
wanted to add what I have found so that others can start somewhere.
So far, the original attached file has mostly worked for me under
VS2005SP1 (only tested unordered_set & unordered_map). However, as one of
the earlier posters noted, it does not work for the case:
{{{
boost::unordered_map<int, boost::unordered_set<int> >
}}}
The problem is the `$T2` substitution. When VS does the text substitution
in the pointer cast, it simply replaces `$T2` with the second template
argument. The problem is the ambiguity with templates and the `>>`
string. The original line is:
{{{
((std::pair<$T1 const ,$T2>
*)(boost::unordered_detail::value_base<std::pair<$T1 const ,$T2> >
*)(boost::unordered_detail::hash_node<std::allocator<std::pair<$T1 const
,$T2> >,boost::unordered_detail::ungrouped> *)&$e)
}}}
If you have a plain map, like say `unordered_map<int,int>`, then this
expands to:
{{{
((std::pair<int const ,int>
*)(boost::unordered_detail::value_base<std::pair<int const ,int> >
*)(boost::unordered_detail::hash_node<std::allocator<std::pair<int const
,int> >,boost::unordered_detail::ungrouped> *)&$e)
}}}
VS is ok with this, and the visualizer works. If you have a map where the
second template argument is itself a template, (like
`unordered_map<int,unordered_set<int> >`), you get:
{{{
((std::pair<int const ,unordered_set<int>>
*)(boost::unordered_detail::value_base<std::pair<int const
,unordered_set<int>> >
*)(boost::unordered_detail::hash_node<std::allocator<std::pair<int const
,unordered_set<int>> >,boost::unordered_detail::ungrouped> *)&$e)
}}}
VS is NOT ok with this. The problem is in the `>>` that results due to
the plain text substitution it performs. A workaround would be to add a
space after each instance of `$T2` in the original line:
{{{
((std::pair<$T1 const ,$T2 >
*)(boost::unordered_detail::value_base<std::pair<$T1 const ,$T2 > >
*)(boost::unordered_detail::hash_node<std::allocator<std::pair<$T1 const
,$T2 > >,boost::unordered_detail::ungrouped> *)&$e)
}}}
This fixes the case where the second template argument is itself a
template, but breaks the first case (where it is not). So, with all of
this, you can have one or the other (templates or no templates...).
My naive workaround (and I don't have it in front of me, sorry), is to
double up the entire `#array` statement, with one version being the "with
spaces" and one the "without". This means you end up with double the
elements in the visualizer, half of which are always `(error)`, while the
other half are correct. That gets me at least half-way there, while being
more expensive with screen real-estate.
Hope this helps anyone else who stumbles across this page.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4209#comment:9> 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:07 UTC