| 7 | #include <vector> |
| 8 | |
| 9 | int main() |
| 10 | { |
| 11 | struct Book { |
| 12 | std::string title; |
| 13 | std::string isbn; |
| 14 | }; |
| 15 | |
| 16 | std::vector<Book> books{ |
| 17 | {"Functional Programming in C++", "978-3-20-148410-0"}, |
| 18 | {"Effective C++", "978-3-16-148410-0"}}; |
| 19 | |
| 20 | std::sort( |
| 21 | books.begin(), books.end(), [](const auto& a, const auto& b) { |
| 22 | return a.title < b.title; |
| 23 | }); |
| 24 | |
| 25 | for(const auto& book : books) { std::cout << book.title << '\n'; } |
| 26 | } |