|
Boost : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-04-03 03:02:24
Paul Rose skrev:
> There seems to be a substantial interface change between 1.33 and 1.34
> of ptr_map.
>
> I'm trying to move a largeish project from 1.33 to 1.34. The only
> unsolved problem is that it has 21 separate declarations of a ptr_map,
> each with a dozen or so uses of iterator where *iter has to be replaced
> with *iter->second and iter->key() has to be replaced with iter->first.
>
>
> The 1.34 documentation at http://www.boost-consulting.com/boost/ doesn't
> seem to mention this, and my searches can't seem to turn up where this
> was discussed.
This is not the proper 1.34 documentation.
> I can see why the new interface might be preferred, but can anybody
> provide a reference to the discussion (or other insight) that led to
> this code-breaking change?
Better interface compatibility with std::map s.t. algorithms etc. can be
reused.
The standard interface with std::pair might suck, but it is standard.
> Ideally I'd like my code to work with both 1.33 and 1.34. Any hints on
> how to do this elegantly?
Add your own layer of indirection:
namespace my_namespace
{
template< class PtrMap >
typename PtrMap::key_type ptr_map_key( const PtrMap& )
{
#ifdef BOOST_1_34
..
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk