2021年3月12日星期五

What type do vector strings deduce to?

I'm becoming familiar with using vectors (reading at https://www.learncpp.com/cpp-tutorial/an-introduction-to-stdvector/), and it displays the following code as an example:

// as with std::array, the type can be omitted since C++17  std::vector array4 { 9, 7, 5, 3, 1 }; // deduced to std::vector<int>  

If I use this C++17 style vector initialization with strings, what type will the vector deduce (i.e. std::string, char*, etc.)?

std::vector strArray {"Hello", "world", "!!!"};  
https://stackoverflow.com/questions/66609753/what-type-do-vector-strings-deduce-to March 13, 2021 at 11:07AM

没有评论:

发表评论