aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkFunction.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-04-01 13:08:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-01 13:08:50 -0700
commit03e5161bed3bdfa0d9fb0867378237bac7d8bd12 (patch)
tree6e77852b56077ee4d8ad3f280c155eca103301c4 /src/core/SkFunction.h
parent21deace8efc8e167d8626187ef0e6b4c241324b6 (diff)
Implicit constructors for SkFunction are much more readable.
Diffstat (limited to 'src/core/SkFunction.h')
-rw-r--r--src/core/SkFunction.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/SkFunction.h b/src/core/SkFunction.h
index 98ae789cae..43438dd9e2 100644
--- a/src/core/SkFunction.h
+++ b/src/core/SkFunction.h
@@ -18,20 +18,20 @@ template <typename> class SkFunction;
template <typename R, typename... Args>
class SkFunction<R(Args...)> : SkNoncopyable {
public:
- explicit SkFunction(R (*fn)(Args...)) : fVTable(GetFunctionPointerVTable()) {
+ SkFunction(R (*fn)(Args...)) : fVTable(GetFunctionPointerVTable()) {
// We've been passed a function pointer. We'll just store it.
fFunction = reinterpret_cast<void*>(fn);
}
template <typename Fn>
- explicit SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) > sizeof(void*)), void*) = nullptr)
+ SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) > sizeof(void*)), void*) = nullptr)
: fVTable(GetOutlineVTable<Fn>()) {
// We've got a functor larger than a pointer. We've go to copy it onto the heap.
fFunction = SkNEW_ARGS(Fn, (Forward(fn)));
}
template <typename Fn>
- explicit SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) <= sizeof(void*)), void*) = nullptr)
+ SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) <= sizeof(void*)), void*) = nullptr)
: fVTable(GetInlineVTable<Fn>()) {
// We've got a functor that fits in a pointer. We copy it right inline.
fFunction = NULL; // Quiets a (spurious) warning that fFunction might be uninitialized.
@@ -96,7 +96,6 @@ private:
// TODO:
// - is it worth moving fCall out of the VTable into SkFunction itself to avoid the indirection?
-// - should constructors be implicit?
// - make SkFunction copyable
#endif//SkFunction_DEFINED