Replace checks for C++17 with string view macro

This commit is contained in:
Gudmundur Adalsteinsson 2020-05-16 12:39:54 +00:00
parent a2ef92ef57
commit 6d71b9b541
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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>