mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 10:33:52 +01:00
Replace checks for C++17 with string view macro
This commit is contained in:
parent
a2ef92ef57
commit
6d71b9b541
@ -69,7 +69,7 @@ TEST_CASE("socket options", "[socket]")
|
|||||||
socket.set(zmq::sockopt::routing_id, "foobar");
|
socket.set(zmq::sockopt::routing_id, "foobar");
|
||||||
socket.set(zmq::sockopt::routing_id, zmq::buffer(id));
|
socket.set(zmq::sockopt::routing_id, zmq::buffer(id));
|
||||||
socket.set(zmq::sockopt::routing_id, id);
|
socket.set(zmq::sockopt::routing_id, id);
|
||||||
#ifdef ZMQ_CPP17
|
#if defined(ZMQ_HAS_STRING_VIEW) && (ZMQ_HAS_STRING_VIEW > 0)
|
||||||
socket.set(zmq::sockopt::routing_id, std::string_view{id});
|
socket.set(zmq::sockopt::routing_id, std::string_view{id});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
4
zmq.hpp
4
zmq.hpp
@ -582,7 +582,7 @@ class message_t
|
|||||||
{
|
{
|
||||||
return std::string(static_cast<const char *>(data()), size());
|
return std::string(static_cast<const char *>(data()), size());
|
||||||
}
|
}
|
||||||
#ifdef ZMQ_CPP17
|
#if defined(ZMQ_HAS_STRING_VIEW) && (ZMQ_HAS_STRING_VIEW > 0)
|
||||||
// interpret message content as a string
|
// interpret message content as a string
|
||||||
std::string_view to_string_view() const noexcept
|
std::string_view to_string_view() const noexcept
|
||||||
{
|
{
|
||||||
@ -1662,7 +1662,7 @@ class socket_base
|
|||||||
set_option(Opt, buf.data(), buf.size());
|
set_option(Opt, buf.data(), buf.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZMQ_CPP17
|
#if defined(ZMQ_HAS_STRING_VIEW) && (ZMQ_HAS_STRING_VIEW > 0)
|
||||||
// Set array socket option, e.g.
|
// Set array socket option, e.g.
|
||||||
// `socket.set(zmq::sockopt::routing_id, id_str)`
|
// `socket.set(zmq::sockopt::routing_id, id_str)`
|
||||||
template<int Opt, int NullTerm>
|
template<int Opt, int NullTerm>
|
||||||
|
Loading…
Reference in New Issue
Block a user