diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2023-10-20 05:33:37 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-10-20 17:33:26 +0300 |
commit | 04b0e33c15ba4774a3fc914399594340e87dc706 (patch) | |
tree | 52344172f0c340ecec923549e47c9ea7c5d93020 /include | |
parent | 2b5b4dae1925b4b0884b5ed2be0a34dff851372c (diff) | |
download | bmcweb-04b0e33c15ba4774a3fc914399594340e87dc706.tar.xz |
multipart-parser: use emplace_back
clang-17 will have a stronger 'modernize-use-emplace' check and
fails with the following warning:
```
../include/multipart_parser.hpp:308:33: error: use emplace_back instead of push_back [modernize-use-emplace,-warnings-as-errors]
308 | mime_fields.push_back({});
| ^~~~~~~~~~~~
| emplace_back(
```
The vector::emplace_back needed an extra hint, as it would not directly
coerce an initializer-list into the vector's value_type, so we need to
use the value_type constructor.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I74417e0ff5a6e0991bfbe4936b4814f6ee4c1269
Diffstat (limited to 'include')
-rw-r--r-- | include/multipart_parser.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp index f707abfa5a..94983f2456 100644 --- a/include/multipart_parser.hpp +++ b/include/multipart_parser.hpp @@ -105,7 +105,7 @@ class MultipartParser return ParserError::ERROR_BOUNDARY_LF; } index = 0; - mime_fields.push_back({}); + mime_fields.emplace_back(FormPart{}); state = State::HEADER_FIELD_START; break; } @@ -305,7 +305,7 @@ class MultipartParser { // unset the PART_BOUNDARY flag flags = Boundary::NON_BOUNDARY; - mime_fields.push_back({}); + mime_fields.emplace_back(FormPart{}); state = State::HEADER_FIELD_START; return ParserError::PARSER_SUCCESS; } |