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
+7 -5
View File
@@ -166,8 +166,9 @@ GroupHost::GroupHost(
boost::asio::local::stream_protocol::socket group_socket(io_context);
group_socket.connect(group_socket_path.string());
write_object(group_socket, GroupRequest{plugin_path.string(),
socket_endpoint.string()});
write_object(group_socket,
GroupRequest{.plugin_path = plugin_path.string(),
.socket_path = socket_endpoint.string()});
const auto response = read_object<GroupResponse>(group_socket);
host_pid = response.pid;
@@ -202,9 +203,10 @@ GroupHost::GroupHost(
io_context);
group_socket.connect(group_socket_path.string());
write_object(group_socket,
GroupRequest{plugin_path.string(),
socket_endpoint.string()});
write_object(
group_socket,
GroupRequest{.plugin_path = plugin_path.string(),
.socket_path = socket_endpoint.string()});
const auto response =
read_object<GroupResponse>(group_socket);
+3 -1
View File
@@ -155,7 +155,9 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
incoming_midi_events.push_back(
std::get<DynamicVstEvents>(event.payload));
EventResult response{1, nullptr, std::nullopt};
EventResult response{.return_value = 1,
.payload = nullptr,
.value_payload = std::nullopt};
return response;
} else {