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

Function FastestCar

12.14-constexprAllocation2/main.cpp:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

CreateCarFunction · 0.70
speedMethod · 0.45

Tested by

no test coverage detected