From 92beef83484f4d9bf216ab1ed3775b9eefc89cc4 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Wed, 27 Mar 2024 22:03:26 -0700 Subject: [PATCH] avoid some object copies --- ixwebsocket/IXWebSocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ixwebsocket/IXWebSocket.cpp b/ixwebsocket/IXWebSocket.cpp index b74426ef..8ba50eea 100644 --- a/ixwebsocket/IXWebSocket.cpp +++ b/ixwebsocket/IXWebSocket.cpp @@ -209,7 +209,7 @@ namespace ix WebSocketHttpHeaders headers(_extraHeaders); std::string subProtocolsHeader; - auto subProtocols = getSubProtocols(); + const auto &subProtocols = getSubProtocols(); if (!subProtocols.empty()) { // @@ -219,7 +219,7 @@ namespace ix // 'json,msgpack' // int i = 0; - for (auto subProtocol : subProtocols) + for (const auto & subProtocol : subProtocols) { if (i++ != 0) {