Enhancing Type Safety with std::variant in C++ Projects