aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-18 16:58:39 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-18 16:58:39 -0700
commit00e891dc31bb23d77cceeeec52be7dd64176bbab (patch)
tree17bfc2400076d2e2fcd669a18de1ecaed0aa299b /system
parentd54f3a7b86e2b266cc86341b6e06096dc7f04d5e (diff)
parent22d2a0fcd2729d9c0c8d53e59471432ddf206b6a (diff)
Merge pull request #2432 from dlardi/incoming
Added embind support for std::unique_ptr
Diffstat (limited to 'system')
-rw-r--r--system/include/emscripten/bind.h4
-rw-r--r--system/include/emscripten/wire.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index 7bc28ff6..67e7c6a3 100644
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -422,8 +422,8 @@ namespace emscripten {
namespace internal {
template<typename ClassType, typename... Args>
- ClassType* operator_new(Args... args) {
- return new ClassType(args...);
+ ClassType* operator_new(Args&&... args) {
+ return new ClassType(std::forward<Args>(args)...);
}
template<typename WrapperType, typename ClassType, typename... Args>
diff --git a/system/include/emscripten/wire.h b/system/include/emscripten/wire.h
index c20e2f55..1a9432d6 100644
--- a/system/include/emscripten/wire.h
+++ b/system/include/emscripten/wire.h
@@ -293,7 +293,6 @@ namespace emscripten {
}
};
- // Is this necessary?
template<typename T>
struct GenericBindingType<std::unique_ptr<T>> {
typedef typename BindingType<T>::WireType WireType;
@@ -301,6 +300,10 @@ namespace emscripten {
static WireType toWireType(std::unique_ptr<T> p) {
return BindingType<T>::toWireType(*p);
}
+
+ static std::unique_ptr<T> fromWireType(WireType wt) {
+ return std::unique_ptr<T>(new T(std::move(BindingType<T>::fromWireType(wt))));
+ }
};
template<typename Enum>