From 7aa1aa542393d783b792c6ba8e7ba9712b88ce7e Mon Sep 17 00:00:00 2001 From: Tibor Bizjak Date: Fri, 14 Jul 2023 12:51:19 +0200 Subject: [PATCH] Fixed namespace termination comments in AdTypes.h, simplified init_ego_vehicle in AdFunctions.cc --- udemy-cpp/exc01/AdFunctions.cc | 13 ++++++------- udemy-cpp/exc01/AdTypes.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/udemy-cpp/exc01/AdFunctions.cc b/udemy-cpp/exc01/AdFunctions.cc index 53f2ef1..74391e7 100644 --- a/udemy-cpp/exc01/AdFunctions.cc +++ b/udemy-cpp/exc01/AdFunctions.cc @@ -22,20 +22,19 @@ namespace Data Types::Vehicle init_ego_vehicle() { - Types::Vehicle ev = - {.id = Constants::EGO_VEHICLE_ID, - .lane = Types::Lane::Center, - .speed_mps = Utils::kph_to_mps(135), - .rel_distance_m = 0, + return Types::Vehicle{ + .id = Constants::EGO_VEHICLE_ID, + .lane = Types::Lane::Center, + .speed_mps = Utils::kph_to_mps(135), + .rel_distance_m = 0, }; - return ev; } } // namespace Ad::Data namespace Visualize { - + void print_vehicle(const Types::Vehicle vehicle) { std::cout << "Vehicle " << vehicle.id << '\n'; diff --git a/udemy-cpp/exc01/AdTypes.h b/udemy-cpp/exc01/AdTypes.h index 4a1dad4..26f184f 100644 --- a/udemy-cpp/exc01/AdTypes.h +++ b/udemy-cpp/exc01/AdTypes.h @@ -25,5 +25,5 @@ struct Vehicle double rel_distance_m; }; -} // namespace Types +} // namespace Ad::Types } // namespace Ad