Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6716: Unexpected behaviour when constructing iterator_range from string literal
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-04-15 08:27:04
#6716: Unexpected behaviour when constructing iterator_range from string literal
-------------------------------------------------------+--------------------
Reporter: Olaf van der Spek <olafvdspek@â¦> | Owner: neilgroves
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: range
Version: Boost 1.48.0 | Severity: Problem
Resolution: invalid | Keywords:
-------------------------------------------------------+--------------------
Changes (by neilgroves):
* status: new => closed
* resolution: => invalid
Comment:
This report is invalid. There is not an automatic construction from string
literals. Historically many versions ago, there was an attempt to handle
string literals seamlessly. This proved to not work well.
Your example is an iterator_range explicitly constructed to be of length 4
ie. the null terminator has been removed from the const char* range.
When compared to the const char[5] literal "Olaf\0" this is handled as any
array would be. Since the size of the array is different it is not
considered equal.
When dealing with literal strings it is documented that one should use
as_literal.
http://www.boost.org/doc/libs/1_49_0/libs/range/doc/html/range/reference/concept_implementation/semantics/functions.html
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6716#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:50:09 UTC