Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
ptr<T>::alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
egwynn committed Oct 31, 2013
1 parent e0749d8 commit 1911530
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions async/refcnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,13 @@ class ptr : public refpriv, public refops <T> {
if (pp) {
rinc (pp);
if (decme)
dec ();
dec ();
p = refpriv::rp (pp);
c = rc (pp);
}
else {
if (decme)
dec ();
dec ();
p = NULL;
c = NULL;
}
Expand Down Expand Up @@ -542,6 +542,12 @@ class ptr : public refpriv, public refops <T> {
{ rinc (r); dec (); p = refpriv::rp (r); c = rc (r); return *this; }
template<class U> ptr<T> &operator= (const ::ref<U> &r)
{ rinc (r); dec (); p = refpriv::rp (r); c = rc (r); return *this; }

template <typename... Params>
void alloc(Params&&... args) {
set(New refcounted<T>(std::forward<Params>(args)...), true);
}

};

template<class T>
Expand Down

0 comments on commit 1911530

Please sign in to comment.