bangnoise / ofxHapPlayer

A Hap player for OpenFrameworks
Other
147 stars 44 forks source link

libavformat branch: deleted copy constructor #30

Open michaelbaisch opened 7 years ago

michaelbaisch commented 7 years ago

The work on this branch is very much appreciated. Everything basically works, expect when I tried using a vector to store instances of ofxHapPlayer. It makes sense since the copy constructor isn't implemented. Is there a better way to store dynamically created ofxHapPlayers? If not then is this I guess a way of saying I would love to see this implemented :) (I would do it myself but I know it's very difficult to get it right with pointers and such).

bangnoise commented 7 years ago

Yeah it's on the list to do. For now you'll have to use new/delete (or probably std::shared_ptr to do that for you).

stephanschulz commented 5 years ago

sorry for my noob question.

could you give a short example please, on how to do the new/delete.

The below still cause Call to deleted constructor of 'ofxHapPlayer' error.

 vector<ofxHapPlayer>videos;

       for(int i=0; i<maxVideos; i++){
             videos.push_back(ofxHapPlayer());
        }

thanks.

stephanschulz commented 5 years ago

oh got it.

 ofxHapPlayer* videos;

 videos = new ofxHapPlayer[maxVideos];
bangnoise commented 5 years ago

or use a shared_ptr and let it take care of delete for you

std::vector<std::shared_ptr<ofxHapPlayer>> videos;
// ...
videos.push_back(std::make_shared<ofxHapPlayer>());