Category : shared-ptr

I was dealing with a bothersome error yesterday involving a function meant to delete elements from a vector of shared pointers. Here’s the problematic code: template <typename T> void flush( std::vector<std::shared_ptr<T>>& offers ) { std::vector<unsigned int> idxs; for (unsigned int i = 0; i < offers.size(); i++) { if (!offers[i]->is_available()) { idxs.push_back(i); } } for ..

Read more

I have this class for weak pointer and I need to make some instances to use the code. I managed to create an object but didn’t get to use the overloaded () operator and the bindWeak function. This is what I managed to do. Thanks in advance! #include <memory> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include <boost/make_shared.hpp> ..

Read more