[C++] c++ 实例化一个std::向量 →→→→→进入此内容的聊天室

来自 , 2020-09-07, 写在 C++, 查看 185 次.
URL http://www.code666.cn/view/cd63a3ee
  1. // 实例化一个std::向量
  2. #include <vector>
  3.  
  4. int main() {
  5.         std::vector<int> vecDynamicIntegerArray;
  6.  
  7.         // Instantiate a vector with 10 elements (it can grow larger)
  8.         std::vector<int> vecArrayWithTenElements(10);
  9.  
  10.         // Instantiate a vector with 10 elements, each initialized to 90
  11.         std::vector<int> vecArrayWithTenInitializedElements(10, 90);
  12.  
  13.         // Instantiate one vector and initialize it to the contents of another
  14.         std::vector<int> vecArrayCopy(vecArrayWithTenInitializedElements);
  15.  
  16.         // Instantiate a vector to 5 elements taken from another
  17.         std::vector<int> vecSomeElementsCopied(vecArrayWithTenElements.begin(),
  18.                         vecArrayWithTenElements.begin() + 5);
  19.  
  20.         return 0;
  21. }
  22.  

回复 "c++ 实例化一个std::向量"

这儿你可以回复上面这条便签

captcha