Skip to content

Commit bce08e6

Browse files
authored
Remove unnecessary copies for AcceptEntry (#2303)
1 parent f4ecb96 commit bce08e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

httplib.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5941,7 +5941,7 @@ inline bool parse_accept_header(const std::string &s,
59415941
return;
59425942
}
59435943

5944-
entries.push_back(accept_entry);
5944+
entries.push_back(std::move(accept_entry));
59455945
});
59465946

59475947
// Return false if any invalid entry was found
@@ -5958,8 +5958,8 @@ inline bool parse_accept_header(const std::string &s,
59585958

59595959
// Extract sorted media types
59605960
content_types.reserve(entries.size());
5961-
for (const auto &entry : entries) {
5962-
content_types.push_back(entry.media_type);
5961+
for (auto &entry : entries) {
5962+
content_types.push_back(std::move(entry.media_type));
59635963
}
59645964

59655965
return true;

0 commit comments

Comments
 (0)