MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / FastestCar

Function FastestCar

12.12-constexprAllocation1/main.cpp:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34constexpr int FastestCar()
35{
36 int max = -1;
37 int maxId = -1;
38 for(int i = 0; i < 3; ++i) {
39 const auto* car = CreateCar(i);
40
41 if(car->speed() > max) {
42 max = car->speed();
43 maxId = i;
44 }
45
46 delete car;
47 }
48
49 return maxId;
50}
51
52int main()
53{

Callers 1

mainFunction · 0.70

Calls 2

CreateCarFunction · 0.70
speedMethod · 0.45

Tested by

no test coverage detected