Skip to content

Commit

Permalink
xrCore/xr_resource: Fixed compilation with GCC.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Nov 6, 2015
1 parent 13d9838 commit 1c3900f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/xrCore/xr_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,25 @@ class resptr_core : public C
typedef resptr_core<T, C> self;
public:
// construction
resptr_core() { p_ = 0; }
resptr_core(T* p, bool add_ref = true) { p_ = p; if (add_ref) _inc(); }
resptr_core(const self& rhs) { p_ = rhs.p_; _inc(); }
~resptr_core() { _dec(); }
resptr_core() { C::p_ = 0; }
resptr_core(T* p, bool add_ref = true) { C::p_ = p; if (add_ref) C::_inc(); }
resptr_core(const self& rhs) { C::p_ = rhs.p_; C::_inc(); }
~resptr_core() { C::_dec(); }

// assignment
self& operator= (const self& rhs) { _set(rhs); return (self&)*this; }

// accessors
T& operator*() const { return *p_; }
T* operator->() const { return p_; }
T& operator*() const { return *C::p_; }
T* operator->() const { return C::p_; }

// unspecified bool type
typedef T* (resptr_core::*unspecified_bool_type) () const;
operator unspecified_bool_type () const { return p_ == 0 ? 0 : &resptr_core::_get; }
bool operator! () const { return p_ == 0; }
operator unspecified_bool_type () const { return C::p_ == 0 ? 0 : &resptr_core::_get; }
bool operator! () const { return C::p_ == 0; }

// fast swapping
void swap(self& rhs) { T* tmp = p_; p_ = rhs.p_; rhs.p_ = tmp; }
void swap(self& rhs) { T* tmp = C::p_; C::p_ = rhs.p_; rhs.p_ = tmp; }
};

// res_ptr == res_ptr
Expand Down

0 comments on commit 1c3900f

Please sign in to comment.