why cant I allocated sf::Music on stack
heres my code:
class Track
{
public:
Track(const std::string&);
const std::string& getName() const;
const sf::Music& getAudio() const;
private:
std::string name;
sf::Music audio;
};
this spits out:error: use of deleted function 'sf::Music::Music(const sf::Music&)'
error: use of deleted function 'sf::SoundStream::SoundStream(const sf::SoundStream&)'
error: use of deleted function 'sf::Mutex::Mutex(const sf::Mutex&)'
error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private NonCopyable(const NonCopyable&);
error: use of deleted function 'sf::InputSoundFile::InputSoundFile(const sf::InputSoundFile&)'
error: use of deleted function 'sf::Mutex::Mutex(const sf::Mutex&)'
class SFML_AUDIO_API Music : public SoundStream
error: use of deleted function 'Track::Track(Track&&)'
but when i allocate it on heap like this:
class Track
{
public:
Track(const std::string&);
const std::string& getName() const;
const sf::Music& getAudio() const;
private:
std::string name;
sf::Music* audio;
};
it works fine
TIA.