mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 18:40:28 +01:00
Problem: message_t::operator== is absurdly inefficient and constructs temporary copies of both operands
Solution: implement operator== using memcmp instead
This commit is contained in:
parent
438bad28e6
commit
c92afb675e
5
zmq.hpp
5
zmq.hpp
@ -393,11 +393,10 @@ namespace zmq
|
||||
|
||||
inline bool operator==(const message_t &other) const ZMQ_NOTHROW
|
||||
{
|
||||
size_t my_size = size ();
|
||||
if (size () != other.size ())
|
||||
return false;
|
||||
const std::string a(data<char>(), size());
|
||||
const std::string b(other.data<char>(), other.size());
|
||||
return a == b;
|
||||
return 0 == memcmp (data (), other.data (), my_size);
|
||||
}
|
||||
|
||||
inline bool operator!=(const message_t &other) const ZMQ_NOTHROW
|
||||
|
Loading…
Reference in New Issue
Block a user