aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkRefCnt.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-03-02 08:06:20 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-02 08:06:20 -0800
commit217c0b3f137d824413e806759bc25378abbe8c18 (patch)
tree8326a2a4f1946aed6cb16688b924ae2511997fba /include/core/SkRefCnt.h
parent734949099166f7bc446a352ce3596dc009484f59 (diff)
sk_make_sp<T>()
because auto atm = sk_make_sp<SkAdvancedTypefaceMetrics>(); is better than sk_sp<SkAdvancedTypefaceMetrics> atm(new SkAdvancedTypefaceMetrics); GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753973002 Review URL: https://codereview.chromium.org/1753973002
Diffstat (limited to 'include/core/SkRefCnt.h')
-rw-r--r--include/core/SkRefCnt.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 43251d0788..e2cf4456f8 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -11,6 +11,7 @@
#include "../private/SkAtomics.h"
#include "../private/SkUniquePtr.h"
#include "SkTypes.h"
+#include <utility>
/** \class SkRefCntBase
@@ -326,4 +327,9 @@ private:
T* fPtr;
};
+template <typename T, typename... Args>
+sk_sp<T> sk_make_sp(Args&&... args) {
+ return sk_sp<T>(new T(std::forward<Args>(args)...));
+}
+
#endif