Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libavformat branch: deleted copy constructor #30

Open
michaelbaisch opened this issue Apr 14, 2017 · 4 comments
Open

libavformat branch: deleted copy constructor #30

michaelbaisch opened this issue Apr 14, 2017 · 4 comments
Assignees

Comments

@michaelbaisch
Copy link

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
Copy link
Owner

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).

@bangnoise bangnoise self-assigned this Apr 14, 2017
@stephanschulz
Copy link

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
Copy link

oh got it.

 ofxHapPlayer* videos;

 videos = new ofxHapPlayer[maxVideos];

@bangnoise
Copy link
Owner

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>());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants