aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
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>