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

Function CreateCar

12.14-constexprAllocation2/main.cpp:24–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22};
23
24constexpr std::unique_ptr<Car> CreateCar(int i)
25{
26 switch(i) {
27 case 0: return std::make_unique<Mercedes>();
28 case 1: return std::make_unique<Toyota>();
29 case 2: return std::make_unique<Tesla>();
30 }
31
32 return nullptr;
33}
34
35constexpr int FastestCar()
36{

Callers 2

FastestCarFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected