0

I am trying to replace a string in a vector of structs.

struct Song
{
    string artist;
    string title;
    string album;
    double m_price;
    string year;
    size_t length;
};

vector<Song> c_collection;

Then I used this loop to replace a string "[None]" in 'album' with 6 spaces:

for (auto& c : c_collection)
    {
        std::replace(c.album.begin(), c.album.end(), string("[None]"), string("      "));
    }

Compiler shows an error which says:

 "cannot convert from 'const_Ty' to 'char' with [  _Ty=std::string  ]".

What did i do wrong?

Geno C
  • 1,401
  • 3
  • 11
  • 26
Dr_Cringe
  • 3
  • 3

0 Answers0