From 22d2a0fcd2729d9c0c8d53e59471432ddf206b6a Mon Sep 17 00:00:00 2001 From: Nikolay Vorobyov Date: Wed, 18 Jun 2014 16:44:03 +0300 Subject: Added embind support for std::unique_ptr --- system/include/emscripten/bind.h | 4 ++-- system/include/emscripten/wire.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'system') 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 - ClassType* operator_new(Args... args) { - return new ClassType(args...); + ClassType* operator_new(Args&&... args) { + return new ClassType(std::forward(args)...); } template 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 struct GenericBindingType> { typedef typename BindingType::WireType WireType; @@ -301,6 +300,10 @@ namespace emscripten { static WireType toWireType(std::unique_ptr p) { return BindingType::toWireType(*p); } + + static std::unique_ptr fromWireType(WireType wt) { + return std::unique_ptr(new T(std::move(BindingType::fromWireType(wt)))); + } }; template -- cgit v1.2.3-70-g09d2