AutoCloseDir: Use std::unique_ptr
This commit is contained in:
parent
2b9d0a99cb
commit
8079ab87a2
4 changed files with 20 additions and 65 deletions
|
@ -180,18 +180,15 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class AutoCloseDir
|
||||
struct DIRDeleter
|
||||
{
|
||||
DIR * dir;
|
||||
public:
|
||||
AutoCloseDir();
|
||||
AutoCloseDir(DIR * dir);
|
||||
~AutoCloseDir();
|
||||
void operator =(DIR * dir);
|
||||
operator DIR *();
|
||||
void close();
|
||||
void operator()(DIR * dir) const {
|
||||
closedir(dir);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::unique_ptr<DIR, DIRDeleter> AutoCloseDir;
|
||||
|
||||
|
||||
class Pid
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue