mirror of https://github.com/odrling/Aegisub
Add operator unspecified-bool-type to agi::scoped_ptr
Originally committed to SVN as r5844.
This commit is contained in:
parent
d4ee9da474
commit
0b742ef3c1
|
@ -33,12 +33,15 @@ class scoped_ptr {
|
||||||
T* ptr;
|
T* ptr;
|
||||||
scoped_ptr(scoped_ptr const&);
|
scoped_ptr(scoped_ptr const&);
|
||||||
scoped_ptr& operator=(scoped_ptr const&);
|
scoped_ptr& operator=(scoped_ptr const&);
|
||||||
|
|
||||||
|
typedef T *scoped_ptr<T>::*unspecified_bool_type;
|
||||||
public:
|
public:
|
||||||
typedef T element_type;
|
typedef T element_type;
|
||||||
|
|
||||||
T& operator*() const {return *ptr; }
|
T& operator*() const {return *ptr; }
|
||||||
T* operator->() const { return ptr; }
|
T* operator->() const { return ptr; }
|
||||||
T* get() const { return ptr; }
|
T* get() const { return ptr; }
|
||||||
|
operator unspecified_bool_type() const { return ptr ? &scoped_ptr<T>::ptr : 0; }
|
||||||
|
|
||||||
void reset(T *p = 0) {
|
void reset(T *p = 0) {
|
||||||
delete ptr;
|
delete ptr;
|
||||||
|
|
Loading…
Reference in New Issue