mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-16 09:51:56 +00:00
@@ -27,6 +27,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
friend inline bool operator==(const ResourceWrapper& lhs, nullptr_t) noexcept {
|
||||
return !lhs.p_;
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const ResourceWrapper& lhs, nullptr_t) noexcept {
|
||||
return !!lhs.p_;
|
||||
}
|
||||
|
||||
friend inline T *get_impl(const ResourceWrapper& rw) {
|
||||
return rw.p_;
|
||||
}
|
||||
@@ -39,21 +47,6 @@ private:
|
||||
T *p_;
|
||||
|
||||
void free_resource() { if (p_) unref_res(p_); }
|
||||
|
||||
// Helper for enabling 'if (sp)'
|
||||
struct Tester {
|
||||
Tester() {}
|
||||
private:
|
||||
void operator delete(void*);
|
||||
};
|
||||
public:
|
||||
// enable 'if (sp)'
|
||||
operator Tester*() const {
|
||||
if (!*this)
|
||||
return 0;
|
||||
static Tester t;
|
||||
return &t;
|
||||
}
|
||||
};
|
||||
|
||||
namespace glib {
|
||||
|
||||
Reference in New Issue
Block a user