mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Removed unused StaticNeverFreedPointer class from utils.
This commit is contained in:
parent
dd01ece14a
commit
c90258664d
1 changed files with 0 additions and 43 deletions
|
@ -216,46 +216,3 @@ private:
|
|||
T *_p;
|
||||
|
||||
};
|
||||
|
||||
// This pointer is used for static non-POD variables that are allocated
|
||||
// on first use by constructor and are never automatically freed.
|
||||
template <typename T>
|
||||
class StaticNeverFreedPointer {
|
||||
public:
|
||||
explicit StaticNeverFreedPointer(T *p) : _p(p) {
|
||||
}
|
||||
StaticNeverFreedPointer(const StaticNeverFreedPointer<T> &other) = delete;
|
||||
StaticNeverFreedPointer &operator=(const StaticNeverFreedPointer<T> &other) = delete;
|
||||
|
||||
T *data() const {
|
||||
return _p;
|
||||
}
|
||||
T *release() {
|
||||
return base::take(_p);
|
||||
}
|
||||
void reset(T *p = nullptr) {
|
||||
delete _p;
|
||||
_p = p;
|
||||
}
|
||||
bool isNull() const {
|
||||
return data() == nullptr;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
reset();
|
||||
}
|
||||
T *operator->() const {
|
||||
return data();
|
||||
}
|
||||
T &operator*() const {
|
||||
Assert(!isNull());
|
||||
return *data();
|
||||
}
|
||||
explicit operator bool() const {
|
||||
return !isNull();
|
||||
}
|
||||
|
||||
private:
|
||||
T *_p = nullptr;
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue