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

Function main

07.09-mapSortBooksByIsbn3/main.cpp:47–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45#endif
46
47int main()
48{
49#if(__cpp_generic_lambdas >= 201707)
50 const Book effectiveCpp{"Effective C++", "978-3-16-148410-0"};
51 const Book fpCpp{"Functional Programming in C++",
52 "978-3-20-148410-0"};
53
54 const Magazine ix{"iX", "978-3-16-148410-0"};
55 const Magazine overload{"overload", "978-3-20-148410-0"};
56
57 const Price normal{34.95};
58 const Price reduced{24.95};
59
60 MapSortedByIsbn<Book, Price> book2Price{
61 {effectiveCpp, reduced}, {fpCpp, normal}};
62 MapSortedByIsbn<Magazine, Price> magazine2Price{
63 {ix, reduced}, {overload, normal}};
64
65 for(const auto& [k, v] : book2Price) {
66 printf(
67 "%s %s %f\n", k.title.c_str(), k.isbn.c_str(), v.amount);
68 }
69
70#else
71# pragma message("not supported")
72#endif
73}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected