Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
AutoPtr.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef _SKYFIRE_AUTO_PTR_H
7#define _SKYFIRE_AUTO_PTR_H
8
9#include <memory>
10
11namespace Skyfire
12{
13
14 template <class Pointer, class Lock>
15 class AutoPtr : public std::shared_ptr<Pointer>
16 {
17 typedef std::shared_ptr<Pointer> Base;
18
19 public:
20 AutoPtr() : Base() { }
21
22 AutoPtr(Pointer* x) : Base(x) { }
23
24 operator bool() const
25 {
26 return Base::get() != NULL;
27 }
28
29 bool operator !() const
30 {
31 return Base::get() == NULL;
32 }
33
34 bool null() const
35 {
36 return Base::get() == NULL;
37 }
38 };
39
40} // namespace Skyfire
41
42#endif
AutoPtr(Pointer *x)
Definition AutoPtr.h:22
bool operator!() const
Definition AutoPtr.h:29
std::shared_ptr< Pointer > Base
Definition AutoPtr.h:17
bool null() const
Definition AutoPtr.h:34