SHARE
TWEET

Untitled

a guest Mar 21st, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ...
  2. #include <cctype>
  3. ...
  4. //------------------------------------------------------------------------------
  5. // Find a specific album by title
  6. //------------------------------------------------------------------------------
  7. int Jukebox::findAlbumIndex(std::string &pAlbumToSearch)
  8. {
  9.     auto it = find_if(vectorJukebox.begin(), vectorJukebox.end(), [&pAlbumToSearch](const Album &a)
  10.     {
  11.         std::string albumName = a.getAlbum();
  12.  
  13.         return ((albumName.size() == pAlbumToSearch.size()) && std::equal(albumName.begin(), albumName.end(), pAlbumToSearch.begin(), [](char& c1, char& c2) {
  14.             return (c1 == c2 || std::toupper(c1) == std::toupper(c2));
  15.         }));
  16.     });
  17.  
  18.  
  19.     int index = distance(vectorJukebox.begin(), it);
  20.  
  21.     return index;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top