Boost C++ Libraries: Ticket #1302: range test as_literal patch https://svn.boost.org/trac10/ticket/1302 <p> A patch for test/iterator_range.cpp and test/sub_range.cpp failure by missing as_literal. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1302 Trac 1.4.3 Shunsuke Sogame <pstade.mb@…> Fri, 05 Oct 2007 19:23:11 GMT attachment set https://svn.boost.org/trac10/ticket/1302 https://svn.boost.org/trac10/ticket/1302 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">add_as_literal.patch</span> </li> </ul> <p> wrap string literals with as_literal </p> Ticket Markus Schöpflin Fri, 12 Oct 2007 08:30:55 GMT <link>https://svn.boost.org/trac10/ticket/1302#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1302#comment:1</guid> <description> <p> This patch might fix this particular failure, but I don't think it should be applied, as it only masks the real problem. </p> <p> The failure comes from the fact, that range currently is not able to correctly handle char[] types. For example: </p> <pre class="wiki">str = "hello world"; rr = make_iterator_range( str.begin(), str.begin() + 5 ); BOOST_CHECK( rr == "hello" ); </pre><p> This fails because rr (length 5) is compared to a char array (length 6), as the terminating null character is not correctly handled. </p> <p> In boost/range/detail/implementation_help.hpp there is code that should deal with this, but it is commented out: </p> <pre class="wiki">template&lt; class T, std::size_t sz &gt; inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] ) { /* typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c&lt; is_same&lt;char,T&gt;::value || is_same&lt;wchar_t,T&gt;::value, char_or_wchar_t_array_tag, int &gt;::type tag; return array_end&lt;T,sz&gt;( boost_range_array, tag() ); */ return boost_range_array + sz; } </pre><p> If I enable all the deactivated code in this file, all range tests pass for me on Tru64/CXX. </p> <p> 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? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Thorsten Ottosen</dc:creator> <pubDate>Tue, 23 Oct 2007 18:59:10 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1302#comment:2 https://svn.boost.org/trac10/ticket/1302#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> The bahavior for 1.35 makes your patch the correct code. I have applied it. Many thanks :-) </p> <p> -Thorsten </p> Ticket