What’s the best way to check if an element exists in a vector using the C++ vector find approach?

In one of our larger C++ apps, I got tired of repeating the same std::find check all over, so I created a utility like bool contains(const std::vector& vec, const T& item).

Internally it just uses c++ vector find with std::find. It made the codebase much cleaner and kept logic consistent.

It’s especially helpful when checking for config flags or feature toggles.