Re: [Boost-bugs] [Boost C++ Libraries] #1302: range test as_literal patch

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1302: range test as_literal patch
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-10-12 08:30:56


#1302: range test as_literal patch
----------------------------------------------------+-----------------------
  Reporter: Shunsuke Sogame <pstade.mb_at_[hidden]> | Owner: nesotto
      Type: Patches | Status: new
 Milestone: Boost 1.35.0 | Component: range
   Version: Boost 1.34.1 | Severity: Regression
Resolution: | Keywords:
----------------------------------------------------+-----------------------
Comment (by schoepflin):

 This patch might fix this particular failure, but I don't think it should
 be applied, as it only masks the real problem.

 The failure comes from the fact, that range currently is not able to
 correctly handle char[] types. For example:

 {{{
 str = "hello world";
 rr = make_iterator_range( str.begin(), str.begin() + 5 );
 BOOST_CHECK( rr == "hello" );
 }}}

 This fails because rr (length 5) is compared to a char array (length 6),
 as the terminating null character is not correctly handled.

 In boost/range/detail/implementation_help.hpp there is code that should
 deal with this, but it is commented out:

 {{{
 template< class T, std::size_t sz >
 inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
 {
   /*
   typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c<
     is_same<char,T>::value || is_same<wchar_t,T>::value,
     char_or_wchar_t_array_tag, int >::type tag;

   return array_end<T,sz>( boost_range_array, tag() );
   */
   return boost_range_array + sz;
 }
 }}}

 If I enable all the deactivated code in this file, all range tests pass
 for me on Tru64/CXX.

 Thorsten, is there a reason that prevents you from enabling the
 deactivated code? If you lack the time, do you want me the commit the
 modified header?

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1302#comment:1>
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:49:56 UTC