My feeling would be that the const char* version should be specifically
disabled for the following reasons:
1. it encourages the use of unwrapped c-style strings.
2. c++17 will soon be offering string_view, which will already perform as
intended.
3. not all char buffers are null-terminated. expecting the buffer to be so
can be equally surprising.
4. const char* is not a Range, and it is trivial to wrap it so that it
behaves like one.
If disabled, the ensuing error message could even me a nicely worded string
(via static_assert) that what the user is about to do is dangerous. An
alternative can be suggested in the same string. Now the the function has
become safe and educational.
On 13 August 2016 at 03:33, Rob Stewart
On August 11, 2016 9:00:12 PM EDT, "Зайцев Александр"
wrote: Hello. I have some question about some case for 'is_palindrome' algo.
'is_palindrome' algorithm checks a sequence - if sequence is a palindromeor empty, function returns true, in other cases returns false.
But in case e.g. "a" (is_palindrome("a")) result is false, because "a" = {'a', '\0'}. And maybe this behaviour is unexpected for users.
So... what do you think about it? Should I implement special version for const char* or not?
That certainly seems appropriate to me.
-- Rob
(Sent from my portable computation device.)
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/ mailman/listinfo.cgi/boost