diff options
author | Chad Austin <chad@imvu.com> | 2014-04-01 10:21:19 -0700 |
---|---|---|
committer | Chad Austin <chad@chadaustin.me> | 2014-04-13 09:08:41 -0700 |
commit | 5b57fb6c4f6b149bf73b598c987dc275fe450c2b (patch) | |
tree | 73b55bc84b0131d893ef397a3c49ddd19e761c52 | |
parent | e4cfbda44856c3b7bc4081d3828423971cbedf1d (diff) |
Always require an explicit name for shared_ptr and wrapper type bindings
-rw-r--r-- | system/include/emscripten/bind.h | 10 | ||||
-rw-r--r-- | tests/embind/embind_test.cpp | 4 |
2 files changed, 4 insertions, 10 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index 1c7daeba..0de16043 100644 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -890,7 +890,7 @@ namespace emscripten { } template<typename PointerType> - const class_& smart_ptr(const char* name = typeid(PointerType).name()) const { + const class_& smart_ptr(const char* name) const { using namespace internal; typedef smart_ptr_trait<PointerType> PointerTrait; @@ -933,12 +933,6 @@ namespace emscripten { } template<typename SmartPtr, typename... Args, typename... Policies> - const class_& smart_ptr_constructor(SmartPtr (*factory)(Args...), Policies&&... policies) const { - // TODO: once everyone has manually specified a name, remove this - return smart_ptr_constructor(typeid(SmartPtr).name(), factory, std::forward<Policies>(policies)...); - } - - template<typename SmartPtr, typename... Args, typename... Policies> const class_& smart_ptr_constructor(const char* smartPtrName, SmartPtr (*factory)(Args...), Policies...) const { using namespace internal; @@ -955,7 +949,7 @@ namespace emscripten { } template<typename WrapperType, typename PointerType = WrapperType*> - const class_& allow_subclass(const char* wrapperClassName = typeid(WrapperType).name()) const { + const class_& allow_subclass(const char* wrapperClassName) const { using namespace internal; auto cls = class_<WrapperType, base<ClassType>>(wrapperClassName) diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp index 48529b9e..1b835751 100644 --- a/tests/embind/embind_test.cpp +++ b/tests/embind/embind_test.cpp @@ -1826,7 +1826,7 @@ EMSCRIPTEN_BINDINGS(tests) { auto HeldBySmartPtr_class = class_<HeldBySmartPtr>("HeldBySmartPtr"); HeldBySmartPtr_class .smart_ptr<CustomSmartPtr<HeldBySmartPtr>>("CustomSmartPtr<HeldBySmartPtr>") - .smart_ptr_constructor(&std::make_shared<HeldBySmartPtr, int, std::string>) + .smart_ptr_constructor("shared_ptr<HeldbySmartPtr>", &std::make_shared<HeldBySmartPtr, int, std::string>) .class_function("newCustomPtr", HeldBySmartPtr::newCustomPtr) .function("returnThis", &takesHeldBySmartPtrSharedPtr) .property("i", &HeldBySmartPtr::i) @@ -2249,7 +2249,7 @@ std::shared_ptr<Base> return_Base_from_DerivedWithOffset(std::shared_ptr<Derived EMSCRIPTEN_BINDINGS(with_adjustment) { class_<DerivedWithOffset, base<Base>>("DerivedWithOffset") - .smart_ptr_constructor(&std::make_shared<DerivedWithOffset>) + .smart_ptr_constructor("shared_ptr<DerivedWithOffset>", &std::make_shared<DerivedWithOffset>) ; function("return_Base_from_DerivedWithOffset", &return_Base_from_DerivedWithOffset); |