Use designated initializers for complex structs

This was one of the main reasons why I wanted to switch to C++20, I just
forgot to do it.
This commit is contained in:
Robbert van der Helm
2020-07-23 14:11:00 +02:00
parent cd02ab5fc9
commit 523f77d334
4 changed files with 25 additions and 11 deletions
+6 -3
View File
@@ -132,7 +132,9 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
// of this object will be sent over the `dispatcher()` socket. This would be
// done after the host calls `effOpen()`, and when the plugin calls
// `audioMasterIOChanged()`.
write_object(host_vst_control, EventResult{0, *plugin, std::nullopt});
write_object(host_vst_control, EventResult{.return_value = 0,
.payload = *plugin,
.value_payload = std::nullopt});
// After sending the AEffect struct we'll receive this instance's
// configuration as a response
@@ -218,8 +220,9 @@ void Vst2Bridge::handle_dispatch_midi_events() {
plugin, event.opcode, event.index, event.value,
&events.as_c_events(), event.option);
EventResult response{return_value, nullptr,
std::nullopt};
EventResult response{.return_value = return_value,
.payload = nullptr,
.value_payload = std::nullopt};
return response;
} else {