Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Removing items from vectors, using references

$
0
0

I had decided to wait until 0.9.0 to release to continue with this project so I could try out the lambda function route, but I'm still having some issues getting the vector removed. I feel like the logic works out better now than it did before, but I'm still pretty hacky when it comes to non-oF c++.

now in ofApp::update() I am trying to remove the element with:

braid[i].erase(
         std::remove_if(braid[i].begin(), braid[i].end(),
         [](const oscThread & o) { return o.dead; }),
         braid[i].end());

or alternately:

ofRemove(braid[i], [](const oscThread& o) { return o.ttLength == 0; });

and within my class, I am just setting dead to true upon the conditions that I want. I am getting no response when trying to erase.

Here is the full code below:

ofApp.h

ofApp.cpp

oscThread.h

oscThread.cpp


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>