Re: [Boost-bugs] [Boost C++ Libraries] #5963: Patch [Fixes #5961]: Disallow comparisons of differing iterator types in ptr_container

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5963: Patch [Fixes #5961]: Disallow comparisons of differing iterator types in ptr_container
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-09-29 16:56:17


#5963: Patch [Fixes #5961]: Disallow comparisons of differing iterator types in
ptr_container
--------------------------------------------------+-------------------------
  Reporter: Rob Desbois <rob.desbois@…> | Owner: nesotto
      Type: Patches | Status: new
 Milestone: To Be Determined | Component: ptr_container
   Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords: iterator, type, compare
--------------------------------------------------+-------------------------

Comment (by Rob Desbois <rob.desbois@…>):

 Yes that would be simpler..

 How about the following?
 {{{
    // Helper struct that determines compatibility
    template<typename T, typename U>
    struct_is_compatible
    {
       static const bool value = typename boost::is_same< typename
 boost::remove_const<T>::type, typename boost::remove_const<U>::type
>::value;
    };


    // And add the assertion to each operator like this:
    template< class VoidIterT, class T, class VoidIterU, class U >
    inline bool operator==( const void_ptr_iterator<VoidIterT,T>& l,
                            const void_ptr_iterator<VoidIterU,U>& r )
    {
       BOOST_STATIC_ASSERT((is_compatible<T, U>::value));
       // ...
    }
 }}}


 where should the helper struct go? I'm guessing directly in the boost
 namespace isn't ideal..

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5963#comment:5>
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