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
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp
index f707abf..94983f2 100644
--- a/include/multipart_parser.hpp
+++ b/include/multipart_parser.hpp
@@ -105,7 +105,7 @@
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 @@
{
// 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;
}