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

Function main

Exercises/NoModules/Chapter 18/Soln18_01/Soln18_01.cpp:14–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12*/
13
14int main()
15{
16 const double dimLimit {99.0}; // Upper limit on Box dimensions
17 Truckload load;
18 const size_t boxCount {20}; // Number of Box object to be created
19
20 // Create boxCount Box objects
21 for (size_t i {}; i < boxCount; ++i)
22 load.addBox(randomSharedBox());
23
24 std::cout << "The boxes in the Truckload are:\n";
25 std::cout << load << std::endl;
26
27 Truckload moveConstructedLoad{ std::move(load) };
28
29 std::cout << "The boxes in the move constructed Truckload are:\n";
30 std::cout << moveConstructedLoad << std::endl;
31
32 Truckload moveAssignedLoad;
33 moveAssignedLoad = std::move(moveConstructedLoad);
34
35 std::cout << "The boxes in the move assigned Truckload are:\n";
36 std::cout << moveAssignedLoad << std::endl;
37}

Callers

nothing calls this directly

Calls 2

randomSharedBoxFunction · 0.70
addBoxMethod · 0.45

Tested by

no test coverage detected