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

Function FastestCar

12.10-constexprAllocation0/main.cpp:32–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

CreateCarFunction · 0.70
speedMethod · 0.45

Tested by

no test coverage detected