|
Boost : |
Subject: Re: [boost] [containers] flat_multimap compile errorin trunk
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2010-04-22 11:08:43
Steven Watanabe skrev:
> AMDG
>
> Thorsten Ottosen wrote:
>> The following code is making the compiler (vc9) choke:
>
> What's the error message. Do you have a minimal test case?
I've already sent the following patch to Ion. So I think the problem is
solved now.
-Thorsten
Index: flat_map.hpp
===================================================================
--- flat_map.hpp (revision 61481)
+++ flat_map.hpp (working copy)
@@ -843,9 +843,18 @@
template<class D, class S>
static D force_copy(S s)
{
- value_type *vp = reinterpret_cast<value_type *>(&*s);
+ value_type *vp = static_cast<value_type *>(
+ static_cast<void*>(&*s));
return D(vp);
}
+
+ template< class Pair, class InternalPair >
+ static Pair force_pair_copy( const InternalPair& p )
+ {
+ typedef typename Pair::first_type iter;
+ return Pair( force_copy<iter>( p.first ), force_copy<iter>( p.second ) );
+ }
+
/// @endcond
public:
@@ -1313,14 +1322,14 @@
//!
//! <b>Complexity</b>: Logarithmic
std::pair<iterator,iterator> equal_range(const key_type& x)
- { return force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
+ { return force_pair_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
std::pair<const_iterator,const_iterator>
equal_range(const key_type& x) const
- { return force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
+ { return force_pair_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Number of elements for which memory has been allocated.
//! capacity() is always greater than or equal to size().
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk