Skip to content

Commit 4a73735

Browse files
committed
Use {} instead of () for object construction.
Sometimes it is difficult to distinguish between a function call and object construction. It is better to use {} for object construction for this reason.
1 parent 73bc74a commit 4a73735

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

echo_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void handle_request(const std::error_code& error, tcp::socket socket) {
5454
int main()
5555
{
5656
size_t seconds = 5;
57-
asio::steady_timer t(io, asio::chrono::seconds(seconds));
57+
asio::steady_timer t{io, asio::chrono::seconds{seconds}};
5858
printf("Waiting for %zu seconds\n", seconds);
5959
t.async_wait([seconds](const std::error_code &e) {
6060
printf("------------------------------\n");

0 commit comments

Comments
 (0)