How can I get a pointer to the first element in an std::vector?

前端 未结 5 874
春和景丽
春和景丽 2020-12-15 03:33

I want to write data from an std::vector to a socket, using the write function, which has this prototype:

ssize_t write         


        
5条回答
  •  一个人的身影
    2020-12-15 03:45

    By taking the address of the first element, with &vec[0], as the standard (since C++03, I think) demands continous storage of std::vector elements.

提交回复
热议问题