Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- #include <cctype>
- ...
- //------------------------------------------------------------------------------
- // Find a specific album by title
- //------------------------------------------------------------------------------
- int Jukebox::findAlbumIndex(std::string &pAlbumToSearch)
- {
- auto it = find_if(vectorJukebox.begin(), vectorJukebox.end(), [&pAlbumToSearch](const Album &a)
- {
- std::string albumName = a.getAlbum();
- return ((albumName.size() == pAlbumToSearch.size()) && std::equal(albumName.begin(), albumName.end(), pAlbumToSearch.begin(), [](char& c1, char& c2) {
- return (c1 == c2 || std::toupper(c1) == std::toupper(c2));
- }));
- });
- int index = distance(vectorJukebox.begin(), it);
- return index;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement