diff options
author | 2015-09-07 12:45:52 -0700 | |
---|---|---|
committer | 2015-09-07 12:45:52 -0700 | |
commit | a3434d83cf988f930a73aaca5ba88f6f6fa8f547 (patch) | |
tree | bdde2f531a8643d4936cdd402ebd4218393e6e5d /include/private/SkUtility.h | |
parent | 2d126b5c45e65a67a9945afa9294038a8eb3f2c8 (diff) |
Add skstd::unique_ptr and use it.
TBR=bsalomon@google.com
The one gpu include change is just to fix swap in implementation.
Review URL: https://codereview.chromium.org/1330503006
Diffstat (limited to 'include/private/SkUtility.h')
-rw-r--r-- | include/private/SkUtility.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/private/SkUtility.h b/include/private/SkUtility.h new file mode 100644 index 0000000000..a96e8fe292 --- /dev/null +++ b/include/private/SkUtility.h @@ -0,0 +1,32 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkUtility_DEFINED +#define SkUtility_DEFINED + +#include "SkTLogic.h" + +namespace skstd { + +template <typename T> inline remove_reference_t<T>&& move(T&& t) { + return static_cast<remove_reference_t<T>&&>(t); +} + +template <typename T> inline T&& forward(remove_reference_t<T>& t) /*noexcept*/ { + return static_cast<T&&>(t); +} +template <typename T> inline T&& forward(remove_reference_t<T>&& t) /*noexcept*/ { + static_assert(!is_lvalue_reference<T>::value, + "Forwarding an rvalue reference as an lvalue reference is not allowed."); + return static_cast<T&&>(t); +} + +template <typename T> add_rvalue_reference_t<T> declval(); + +} // namespace skstd + +#endif |