aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-04-15 22:26:21 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-18 20:08:15 +0300
commit426cbf616c7a4465e707d6f5cd0d11ab9ce27905 (patch)
tree60bf78741f58c566a8cd0076438f05134ce780a9 /system
parentd2e6efdf4821ff1e9f16fc4884d398619c0d7a06 (diff)
Support returning movable types
Diffstat (limited to 'system')
-rwxr-xr-xsystem/include/emscripten/wire.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/system/include/emscripten/wire.h b/system/include/emscripten/wire.h
index 0e8334e8..6fb15fc7 100755
--- a/system/include/emscripten/wire.h
+++ b/system/include/emscripten/wire.h
@@ -206,6 +206,10 @@ namespace emscripten {
};
template<typename T>
+ struct BindingType<T&> : public BindingType<T> {
+ };
+
+ template<typename T>
struct BindingType<const T&> : public BindingType<T> {
};
@@ -236,10 +240,14 @@ namespace emscripten {
typedef typename std::remove_reference<T>::type ActualT;
typedef ActualT* WireType;
- static WireType toWireType(T v) {
+ static WireType toWireType(const T& v) {
return new T(v);
}
+ static WireType toWireType(T&& v) {
+ return new T(std::forward<T>(v));
+ }
+
static ActualT& fromWireType(WireType p) {
return *p;
}
@@ -282,8 +290,8 @@ namespace emscripten {
{};
template<typename T>
- auto toWireType(const T& v) -> typename BindingType<T>::WireType {
- return BindingType<T>::toWireType(v);
+ auto toWireType(T&& v) -> typename BindingType<T>::WireType {
+ return BindingType<T>::toWireType(std::forward<T>(v));
}
template<typename T>