aboutsummaryrefslogtreecommitdiff
path: root/tests/embind
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-04-17 17:51:24 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-18 20:08:41 +0300
commita02d08a15f853665cee193c7f21e84f48bee8845 (patch)
tree5d36ca5d1787c613ae34d48dcf6fdd0096cf76e6 /tests/embind
parentb4cc2e135b1d611fa54c28bf05aada1657c97b30 (diff)
Make select_overload work for member functions
Diffstat (limited to 'tests/embind')
-rw-r--r--tests/embind/embind_test.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp
index e969f9d8..f2359955 100644
--- a/tests/embind/embind_test.cpp
+++ b/tests/embind/embind_test.cpp
@@ -1925,8 +1925,8 @@ EMSCRIPTEN_BINDINGS(tests) {
function("long_to_string", &long_to_string);
function("unsigned_long_to_string", &unsigned_long_to_string);
- function("overloaded_function", (int(*)(int))&overloaded_function);
- function("overloaded_function", (int(*)(int, int))&overloaded_function);
+ function("overloaded_function", select_overload<int(int)>(&overloaded_function));
+ function("overloaded_function", select_overload<int(int, int)>(&overloaded_function));
class_<MultipleCtors>("MultipleCtors")
.constructor<int>()
@@ -1936,19 +1936,21 @@ EMSCRIPTEN_BINDINGS(tests) {
class_<MultipleOverloads>("MultipleOverloads")
.constructor<>()
- .function("Func", (int(MultipleOverloads::*)(int))&MultipleOverloads::Func)
- .function("Func", (int(MultipleOverloads::*)(int,int))&MultipleOverloads::Func)
+ .function("Func", select_overload<int(int)>(&MultipleOverloads::Func))
+ .function("Func", select_overload<int(int, int)>(&MultipleOverloads::Func))
.function("WhichFuncCalled", &MultipleOverloads::WhichFuncCalled)
- .class_function("StaticFunc", (int(*)(int))&MultipleOverloads::StaticFunc)
- .class_function("StaticFunc", (int(*)(int,int))&MultipleOverloads::StaticFunc)
- .class_function("WhichStaticFuncCalled", &MultipleOverloads::WhichStaticFuncCalled);
+ .class_function("StaticFunc", select_overload<int(int)>(&MultipleOverloads::StaticFunc))
+ .class_function("StaticFunc", select_overload<int(int,int)>(&MultipleOverloads::StaticFunc))
+ .class_function("WhichStaticFuncCalled", &MultipleOverloads::WhichStaticFuncCalled)
+ ;
class_<MultipleOverloadsDerived, base<MultipleOverloads> >("MultipleOverloadsDerived")
.constructor<>()
- .function("Func", (int(MultipleOverloadsDerived::*)(int,int,int))&MultipleOverloadsDerived::Func)
- .function("Func", (int(MultipleOverloadsDerived::*)(int,int,int,int))&MultipleOverloadsDerived::Func)
- .class_function("StaticFunc", (int(*)(int,int,int))&MultipleOverloadsDerived::StaticFunc)
- .class_function("StaticFunc", (int(*)(int,int,int,int))&MultipleOverloadsDerived::StaticFunc);
+ .function("Func", select_overload<int(int,int,int)>(&MultipleOverloadsDerived::Func))
+ .function("Func", select_overload<int(int,int,int,int)>(&MultipleOverloadsDerived::Func))
+ .class_function("StaticFunc", select_overload<int(int,int,int)>(&MultipleOverloadsDerived::StaticFunc))
+ .class_function("StaticFunc", select_overload<int(int,int,int,int)>(&MultipleOverloadsDerived::StaticFunc))
+ ;
}
// tests for out-of-order registration