How can I get a pointer to the first element in an std::vector? August 4, 2023 by Tarik C++11 has vec.data() which has the benefit that the call is valid even if the vector is empty.