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

Function main

07.05-mapSortBooksByIsbn0/main.cpp:28–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 >;
27
28int main()
29{
30 const Book effectiveCpp{"Effective C++", "978-3-16-148410-0"};
31 const Book fpCpp{"Functional Programming in C++",
32 "978-3-20-148410-0"};
33
34 const Price normal{34.95};
35 const Price reduced{24.95};
36
37 // #A Use the map with Price as value
38 MapBookSortedByIsbn<Price> book2Price{
39 {{effectiveCpp, reduced},
40 {fpCpp, normal}}, // #B Add some items to it
41 cmp // #C Sadly we have to know and pass the cmp function
42 };
43
44 for(const auto& [k, v] : book2Price) {
45 printf("%s %s %f\n", k.title.c_str(), k.isbn.c_str(), v.amount);
46 }
47}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected