I'm having trouble with my compiler giving the following error:
539 28 C:\mingw32\include\c++\13.1.0\bits\alloc_traits.h [Error] no matching function for call to 'construct_at(MUSIC*&, MUSIC)'
It deals with an sf::Music object being in a vector of a struct and trying to add new elements of that struct to the vector.
Here is the code:
struct MUSIC
{
sf::Music music;
std::string path = "";
};
namespace ROD
{
std::vector<MUSIC> music;
int CreateMusic(std::string path = "NULL")
{
for(int a=0;a<music.size();a++)
{
if(music[a].path == path)
return a;
}
if(path == "NULL")
return music.size() - 1;
MUSIC newMusic;
if(!newMusic.music.openFromFile(path))
{
return -1;
}
newMusic.path = path;
music.push_back(std::move(newMusic));
return music.size() - 1;
}
}
Any ideas why this is a problem and how to fix it?