Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
gtl::ElementDeleter Class Reference

#include <stl_util.h>

Public Member Functions

template<typename STLContainer >
 ElementDeleter (STLContainer *ptr)
 
 ~ElementDeleter ()
 
 ElementDeleter (const ElementDeleter &)=delete
 
void operator= (const ElementDeleter &)=delete
 

Detailed Description

ElementDeleter is an RAII object that deletes the elements in the given container when it goes out of scope. This is similar to std::unique_ptr<> except that a container's elements will be deleted rather than the container itself.

Example: std::vector<MyProto*> tmp_proto; ElementDeleter d(&tmp_proto); if (...) return false; ... return success;

Since C++11, consider using containers of std::unique_ptr instead.

Definition at line 434 of file stl_util.h.

Constructor & Destructor Documentation

◆ ElementDeleter() [1/2]

template<typename STLContainer >
gtl::ElementDeleter::ElementDeleter ( STLContainer * ptr)
inlineexplicit

Definition at line 437 of file stl_util.h.

◆ ~ElementDeleter()

gtl::ElementDeleter::~ElementDeleter ( )
inline

Definition at line 440 of file stl_util.h.

◆ ElementDeleter() [2/2]

gtl::ElementDeleter::ElementDeleter ( const ElementDeleter & )
delete

Member Function Documentation

◆ operator=()

void gtl::ElementDeleter::operator= ( const ElementDeleter & )
delete

The documentation for this class was generated from the following file: