Allow char ranges in the message_t constructor#673
Conversation
3ecbe6a to
1bc926e
Compare
|
Not sure how to test this more (How to test that the |
1bc926e to
5aae699
Compare
std::string(_view)
5aae699 to
17a530a
Compare
Pull Request Test Coverage Report for Build 21468739280Details
💛 - Coveralls |
|
Yes, so took a bit to figure recall, but the reason is string literals, so template<
class Char,
size_t N,
typename = typename std::enable_if<detail::is_char_type<Char>::value>::type>
ZMQ_DEPRECATED("from 4.7.0, use constructors taking iterators, (pointer, size) "
"or strings instead")
explicit message_t(const Char (&data)[N]) :
message_t(detail::ranges::begin(data), detail::ranges::end(data))
{
}So we need to be sure if we removed this overload, that the other one does not accept string literals. |
|
I see, what was so wrong about this string literal constructor that it was deprecated? Seems useful to me.. Marking it as EDIT: indeed, message_t can be constructed from a string literal with the range constructor if I comment out the deprecated one. Marking it as |
|
Ok. What is wrong it that it includes the null character, which I would say is unexpected. So for backwards compatibility it has to be like it is I guess. |
I'd like to be able to construct a
message_twithstd::vector<char>or other containers with a character as their value type.I assume the condition to disallow this was to avoid conflicts with
std::stringandstd::string_view.