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

Function main

07.13-mapSortBooksByIsbn4/main.cpp:33–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#endif
32
33int main()
34{
35#if(__cpp_generic_lambdas >= 201707)
36 const Book effectiveCpp{"Effective C++", "978-3-16-148410-0"};
37 const Book fpCpp{"Functional Programming in C++", "978-3-20-148410-0"};
38
39 const Magazine ix{"iX", "978-3-16-148410-0"};
40 const Magazine overload{"overload", "978-3-20-148410-0"};
41
42 const Price normal{34.95};
43 const Price reduced{24.95};
44
45 MapSortedByIsbn<Book, Price> book2Price{{effectiveCpp, reduced}, {fpCpp, normal}};
46 MapSortedByIsbn<Magazine, Price> magazine2Price{{ix, reduced}, {overload, normal}};
47
48 for(const auto& [k, v] : book2Price) {
49 printf("%s %s %f\n", k.title.c_str(), k.isbn.c_str(), v.amount);
50 }
51
52#else
53# pragma message("not supported")
54#endif
55}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected