aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-02-28 00:29:10 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:24:27 +0300
commit088e1af2f1311e9b6f9d5b73128794449d1b9adb (patch)
tree6b81bd2c0f5be967792c3e5a623f7fc8c8eb98fa
parent55ebc1f6697261ef6e6e4920a28d41db783dba8c (diff)
allow specialization of get_element_type if using a smart pointer with a different mechanism for looking up the pointee type
-rwxr-xr-xsystem/include/emscripten/bind.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index 3ecd858b..298df4a4 100755
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -538,10 +538,16 @@ namespace emscripten {
// SMART POINTERS
////////////////////////////////////////////////////////////////////////////////
+ // specialize if you have a different pointer type
+ template<typename PointerType>
+ struct get_element_type {
+ typedef typename PointerType::element_type type;
+ };
+
template<typename PointerType>
void smart_ptr(const char* name) {
using namespace internal;
- typedef typename PointerType::element_type PointeeType;
+ typedef typename get_element_type<PointerType>::type PointeeType;
registerStandardTypes();
_embind_register_smart_ptr(
@@ -647,6 +653,23 @@ namespace emscripten {
return *this;
}
+ /*
+ template<typename SmartPtr, typename... Args>
+ class_& constructor(SmartPtr (*factory)(Args...)) {
+ using namespace internal;
+
+ smart_ptr<SmartPtr>("SmartPtr");
+
+ typename WithPolicies<>::template ArgTypeList<void, Args...> args;
+ _embind_register_class_smart_ptr_constructor(
+ TypeID<ClassType>::get(),
+ args.count,
+ args.types,
+ reinterpret_cast<GenericFunction>(&raw_smart_ptr_constructor
+ return *this;
+ }
+ */
+
template<typename WrapperType>
class_& allow_subclass() {
using namespace internal;