We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
but why you use recursion, since you are erasing the element from vector, it doesn't make sense to create several stack entries and then removing them with no result ie void. You can erase all zero entries from vector in one go with combination of erase-remove.
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
but why you use recursion, since you are erasing the element from vector, it doesn't make sense to create several stack entries and then removing them with no result ie void. You can erase all zero entries from vector in one go with combination of erase-remove.
vec.erase(remove(vec.begin(), vec.end(), 0), vec.end());