MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / main

Function main

Examples/NoModules/Chapter 16/Ex16_07C/Ex16_07C.cpp:13–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11std::unique_ptr<double[]> computeValues(size_t howMany); // A function to compute an array of values
12
13int main()
14{
15 try
16 {
17 auto values{ computeValues(10'000) }; // Cannot leak either: resource is managed by RAII object!
18 }
19 catch (const Trouble&)
20 {
21 std::cout << "No worries: I've caught it!" << std::endl;
22 }
23}
24
25std::unique_ptr<double[]> computeValues(size_t howMany)
26{

Callers

nothing calls this directly

Calls 1

computeValuesFunction · 0.70

Tested by

no test coverage detected