[1.35] range::end(const char *) no longer supported?

In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like: const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result); In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further? Thanks, Mat

Hi, Mat Marcus wrote:
In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like:
const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result);
In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further?
You can use as_literal to convert const char* to a range: boos::range<const char*> range(as_literal("foo")); std::copy(boost::begin(range), boost::end(range), result); explicit conversion is required due to ambiguities in representation of character literals. Best regards, Pavol

Mat Marcus skrev:
In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like:
const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result);
In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further?
There are a number of changes to boost.range. I guess they should be written in the "updated libraries" section of the announcement. Is it still possible to update that section, Beman? -Thorsten

Thorsten Ottosen wrote:
Mat Marcus skrev:
In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like:
const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result);
In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further?
There are a number of changes to boost.range. I guess they should be written in the "updated libraries" section of the announcement. Is it still possible to update that section, Beman?
Yes. That's one of the advantages of separating the web site content from the distribution content. Rene can correct me if I'm wrong, but I think procedure is to make the change in the tree rooted at https://svn.boost.org/svn/boost/website/public_html/beta, then verify it worked OK by looking at beta.boost.org. If that looks good, merge the change to the https://svn.boost.org/svn/boost/website/public_html/live tree. --Beman

On Wed, Apr 2, 2008 at 2:54 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
Mat Marcus skrev:
In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like:
const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result);
In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further?
There are a number of changes to boost.range. I guess they should be written in the "updated libraries" section of the announcement. Is it still possible to update that section, Beman?
-Thorsten
Could you please say a bit more about the rationale for the 1.35 changes? I have been unable to use the 1.35.0 version of boost::begin/end/size on ranges due to failures of the type calulcation metacode. Instead I've replaced a number of instances of boost::size(some_range) with std::distance(boost::begin(some_range), boost::end(some_range)), since the use of - operationstogether with the current versions of begin/end causes deduction failures, etc. - Mat

Hi, Mat Marcus wrote:
On Wed, Apr 2, 2008 at 2:54 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
Mat Marcus skrev:
In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like:
const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result);
In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further? There are a number of changes to boost.range. I guess they should be written in the "updated libraries" section of the announcement. Is it still possible to update that section, Beman?
-Thorsten
Could you please say a bit more about the rationale for the 1.35 changes? I have been unable to use the 1.35.0 version of boost::begin/end/size on ranges due to failures of the type calulcation metacode. Instead I've replaced a number of instances of boost::size(some_range) with std::distance(boost::begin(some_range), boost::end(some_range)), since the use of - operationstogether with the current versions of begin/end causes deduction failures, etc.
If I might toss my few cents, the reason for changes come from an ambiguity in usage of character literals. Imagine you have following char str[] = 'h', 'e', 'l', 'l', 'o', 0; or simply char str[] = "hello"; For some algorithms like for-each, it is required, that the range related to this literals contains the trailing 0. On the other hand, string algorithms require that the leading 0 is stripped from the range, since it is only a terminator, not a valid data. To resolve this issue, it was decided to remove implicit support for c-strings altogether and replace it with an explicit one, using as_array and as_literal helpers. These helpers convert the C-string to a range, using the specific semantics. as_litaral should be able to handle also ordinary char* -like strings. So all you need to do, is to convert your char* range using as_literal. Best regards, Pavol

Mat Marcus skrev:
On Wed, Apr 2, 2008 at 2:54 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
Mat Marcus skrev:
In 1.34.1 we rely on boost::range::begin/end for const char* . That is we can invoke something like:
const char* range= "foo"; std::copy(boost::begin(range), boost::end(range), result);
In 1.35.0, under MSVC 9.0, code similar to the above. Are there known issues with range::end(const char*) in 1.35.0 (e.g. no longer supported), or do I need to explore further? There are a number of changes to boost.range. I guess they should be written in the "updated libraries" section of the announcement. Is it still possible to update that section, Beman?
-Thorsten
Could you please say a bit more about the rationale for the 1.35 changes? I have been unable to use the 1.35.0 version of boost::begin/end/size on ranges due to failures of the type calulcation metacode. Instead I've replaced a number of instances of boost::size(some_range) with std::distance(boost::begin(some_range), boost::end(some_range)), since the use of - operationstogether with the current versions of begin/end causes deduction failures, etc.
First, let me enumerate the changes: 1. no default support for null-terminated char pointers 2. boost::end( T (&array)[N] ) always return array + N, also for string literals (these behaviors should be got by using as_literal()) 3. boost_range_begin() is renamed range_begin(), and similar for boost_range_end(). 4. boost::size() requires random access and is guaranteed O(1), boost::distance() has the old behavior 5. There is also some new naming of the metafunctions, but see the docs for how it is -Thorsten
participants (4)
-
Beman Dawes
-
Mat Marcus
-
Pavol Droba
-
Thorsten Ottosen