Use std::vector efficiently