Dynamically allocated arrays or std::vector

前端 未结 10 1902
日久生厌
日久生厌 2021-01-12 21:46

I\'m trying to optimize my C++ code. I\'ve searched the internet on using dynamically allocated C++ arrays vs using std::vector and have generally seen a recommendation in f

10条回答
  •  攒了一身酷
    2021-01-12 22:25

    I agree with rmeador,

      for (int i = 0; vecIt != vecEnd; i++) {
        *(vecIt++) = i; // <-- quick offset calculation
      }
      end = clock();
      cout<<"vector: "<<(double)(end-start)/CLOCKS_PER_SEC<

提交回复
热议问题