Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: include/private/SkFunction.h

Issue 1273813002: Add skstd::move and skstd::forward. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: No need to change the string. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/private/SkFunction.h
diff --git a/include/private/SkFunction.h b/include/private/SkFunction.h
index 8e41cba929a08b4303247f5f1b51474ae2244d66..d7e5f4585750c5061a7d9d624b0dcb45ff6691e3 100644
--- a/include/private/SkFunction.h
+++ b/include/private/SkFunction.h
@@ -35,13 +35,10 @@ public:
R operator()(Args... args) const {
SkASSERT(fFunction.get());
- return fFunction->call(Forward(args)...);
+ return fFunction->call(SkTForward<Args>(args)...);
}
private:
- // ~= std::forward. This moves its argument if possible, falling back to a copy if not.
- template <typename T> static T&& Forward(T& v) { return (T&&)v; }
-
struct Interface {
virtual ~Interface() {}
virtual R call(Args...) const = 0;
@@ -53,7 +50,7 @@ private:
public:
LambdaImpl(const Fn& fn) : fFn(fn) {}
- R call(Args... args) const override { return fFn(Forward(args)...); }
+ R call(Args... args) const override { return fFn(SkTForward<Args>(args)...); }
Interface* clone() const override { return SkNEW_ARGS(LambdaImpl<Fn>, (fFn)); }
private:
Fn fFn;
@@ -63,7 +60,7 @@ private:
public:
FnPtrImpl(R (*fn)(Args...)) : fFn(fn) {}
- R call(Args... args) const override { return fFn(Forward(args)...); }
+ R call(Args... args) const override { return fFn(SkTForward<Args>(args)...); }
Interface* clone() const override { return SkNEW_ARGS(FnPtrImpl, (fFn)); }
private:
R (*fFn)(Args...);

Powered by Google App Engine
This is Rietveld 408576698