
GOAT!
template<typename T>
void removeElement(std::vector<T>& vec, const T& valueToRemove) {
// 벡터를 순회하며 일치하는 요소를 찾아 삭제
for (auto it = vec.begin(); it != vec.end(); ++it) {
if (*it == valueToRemove) {
vec.erase(it); // 일치하는 요소를 삭제
break; // 하나의 요소만 제거하므로 삭제 후 반복을 멈춤
}
}
}
Follow the journey
Get new posts by email.
Short, honest notes on building, startups, learning, failures, and retrospectives, for readers who follow the journey rather than pass through from search.
The newsletter is coming soon. Until then, follow via
RSS
or email me to get notified.