mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-01-19 08:46:45 +01:00
Apply clang-format
This commit is contained in:
parent
1897488a28
commit
ae570b0835
34
zmq.hpp
34
zmq.hpp
@ -350,13 +350,14 @@ inline std::tuple<int, int, int> version()
|
||||
}
|
||||
|
||||
#if !defined(ZMQ_CPP11_PARTIAL)
|
||||
namespace detail{
|
||||
namespace detail
|
||||
{
|
||||
template<class T> struct is_char_type
|
||||
{
|
||||
// true if character type for string literals in C++11
|
||||
static constexpr bool value =
|
||||
std::is_same<T, char>::value || std::is_same<T, wchar_t>::value ||
|
||||
std::is_same<T, char16_t>::value || std::is_same<T, char32_t>::value;
|
||||
std::is_same<T, char>::value || std::is_same<T, wchar_t>::value
|
||||
|| std::is_same<T, char16_t>::value || std::is_same<T, char32_t>::value;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@ -397,8 +398,7 @@ class message_t
|
||||
int rc = zmq_msg_init_size(&msg, size_);
|
||||
if (rc != 0)
|
||||
throw error_t();
|
||||
if (size_)
|
||||
{
|
||||
if (size_) {
|
||||
// this constructor allows (nullptr, 0),
|
||||
// memcpy with a null pointer is UB
|
||||
memcpy(data(), data_, size_);
|
||||
@ -418,13 +418,12 @@ class message_t
|
||||
// when called with a string literal.
|
||||
// An overload taking const char* can not be added because
|
||||
// it would be preferred over this function and break compatiblity.
|
||||
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")
|
||||
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))
|
||||
{
|
||||
@ -441,16 +440,10 @@ class message_t
|
||||
{
|
||||
}
|
||||
|
||||
explicit message_t(const std::string &str) :
|
||||
message_t(str.data(), str.size())
|
||||
{
|
||||
}
|
||||
explicit message_t(const std::string &str) : message_t(str.data(), str.size()) {}
|
||||
|
||||
#if CPPZMQ_HAS_STRING_VIEW
|
||||
explicit message_t(std::string_view str) :
|
||||
message_t(str.data(), str.size())
|
||||
{
|
||||
}
|
||||
explicit message_t(std::string_view str) : message_t(str.data(), str.size()) {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -2191,7 +2184,6 @@ class socket_t : public detail::socket_base
|
||||
throw error_t();
|
||||
if (ctxptr == ZMQ_NULLPTR)
|
||||
throw error_t();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user