[RTEMS Project] #4376: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer std::list

RTEMS trac trac at rtems.org
Mon Apr 5 18:29:36 UTC 2021


#4376: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer std::list
-------------------------+----------------------
  Reporter:  Alex White  |      Owner:  (none)
      Type:  defect      |     Status:  new
  Priority:  normal      |  Milestone:  6.1
 Component:  admin       |    Version:  6
  Severity:  normal      |   Keywords:  coverage
Blocked By:              |   Blocking:
-------------------------+----------------------
 The `Coverage::GenerateReports()` function uses an `std::list<ReportsBase
 *>` to store the `ReportsBase`-derived classes used to generate the
 reports. The function should use an
 `std::vector<std::unique_ptr<ReportsBase>>` instead.

 An `std::vector` is the preferred container type in this case because the
 constant-time insertion and removal properties of `std::list` are not
 needed. The smart pointer type `std::unique_ptr<ReportsBase>` is preferred
 over `ReportsBase *` because it eliminates the need for manual pointer
 deletion at the end of the function.

--
Ticket URL: <http://devel.rtems.org/ticket/4376>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list