mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-31 16:14:51 +02:00
Merge pull request #144 from qsodev/fixpeektyp
fixed peektyp check and return value
This commit is contained in:
commit
8f56e3b522
@ -341,9 +341,10 @@ public:
|
|||||||
T peektyp(size_t index)
|
T peektyp(size_t index)
|
||||||
{
|
{
|
||||||
static_assert(!std::is_same<T, std::string>::value, "Use peekstr() instead of peektyp<std::string>()");
|
static_assert(!std::is_same<T, std::string>::value, "Use peekstr() instead of peektyp<std::string>()");
|
||||||
if(sizeof(T) != m_parts.front().size())
|
if(sizeof(T) != m_parts[index].size())
|
||||||
throw std::runtime_error("Invalid type, size does not match the message size");
|
throw std::runtime_error("Invalid type, size does not match the message size");
|
||||||
T type = *m_parts[index].data<T>();
|
T type = *m_parts[index].data<T>();
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create multipart from type (fixed-size)
|
// Create multipart from type (fixed-size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user