Skip to content

Commit bb86057

Browse files
committed
Fix #5874: Use of designated initializers requires C++20 fails the build
Designated initializers are a feature of C++20: https://en.cppreference.com/w/cpp/language/aggregate_initialization. However, they appeared in https://github.com/google-ai-edge/mediapipe/blob/ffe429d5278b914c44fdb5df3ce38962b55580bb/mediapipe/framework/output_stream_handler.cc#L145-L149 The project uses C++17 and adapting it for C++20 would be non-trivial. The easiest fix is to avoid using aggregated initialization. It is fine while the order of members is preserved: ```cpp struct OutputStreamMonitoringInfo { std::string stream_name; // The total number of packets added to the output stream. int num_packets_added; // The next timestamp bound of the output stream. Timestamp next_timestamp_bound; }; ``` https://github.com/google-ai-edge/mediapipe/blob/eecf8a5696d5e47edbd3b6e99a6064c99f9ab1a4/mediapipe/framework/output_stream_handler.h#L53-L59
1 parent eecf8a5 commit bb86057

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mediapipe/framework/output_stream_handler.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ OutputStreamHandler::GetMonitoringInfo() {
143143
continue;
144144
}
145145
monitoring_info_vector.emplace_back(OutputStreamMonitoringInfo(
146-
{.stream_name = DebugStreamName(id),
147-
.num_packets_added = stream->NumPacketsAdded(),
148-
.next_timestamp_bound = stream->NextTimestampBound()}));
146+
{DebugStreamName(id), stream->NumPacketsAdded(), stream->NextTimestampBound()}));
149147
}
150148
return monitoring_info_vector;
151149
}

0 commit comments

Comments
 (0)