[Openmp-commits] [PATCH] D109276: [OpenMP][libomptarget] Change device vector elements to unique_ptr type

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Sep 4 12:03:51 PDT 2021


ye-luo added inline comments.


================
Comment at: openmp/libomptarget/src/rtl.cpp:325
     for (int32_t device_id = 0; device_id < R.NumberOfDevices; device_id++) {
+      PM->Devices.push_back(std::make_unique<DeviceTy>(&R));
       // global device ID
----------------
tianshilei1992 wrote:
> what about `emplace_back`?
Both push_back and emplace_back do the same thing of invoking the move constructor of unique_ptr. However, emplace_back is less verbose in readability. So push_back is preferred here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109276/new/

https://reviews.llvm.org/D109276



More information about the Openmp-commits mailing list