@@ -1309,6 +1309,12 @@ std::vector<std::shared_ptr<StringHolder>> emval_test_return_shared_ptr_vector()
13091309 return sharedStrVector;
13101310}
13111311
1312+ std::vector<SmallClass*> emval_test_return_vector_pointers () {
1313+ std::vector<SmallClass*> vec;
1314+ vec.push_back (new SmallClass ());
1315+ return vec;
1316+ }
1317+
13121318void test_string_with_vec (const std::string& p1, std::vector<std::string>& v1) {
13131319 // THIS DOES NOT WORK -- need to get as val and then call vecFromJSArray
13141320 printf (" %s\n " , p1.c_str ());
@@ -1339,6 +1345,12 @@ std::optional<SmallClass> embind_test_return_optional_small_class(bool create) {
13391345 }
13401346 return {};
13411347}
1348+ std::optional<SmallClass*> embind_test_return_optional_small_class_pointer (bool create) {
1349+ if (create) {
1350+ return new SmallClass ();
1351+ }
1352+ return {};
1353+ }
13421354
13431355int embind_test_optional_int_arg (std::optional<int > arg) {
13441356 if (arg) {
@@ -1885,6 +1897,7 @@ EMSCRIPTEN_BINDINGS(tests) {
18851897 register_vector<emscripten::val>(" EmValVector" );
18861898 register_vector<float >(" FloatVector" );
18871899 register_vector<std::vector<int >>(" IntegerVectorVector" );
1900+ register_vector<SmallClass*>(" SmallClassPointerVector" );
18881901
18891902 class_<DummyForPointer>(" DummyForPointer" );
18901903
@@ -2352,6 +2365,7 @@ EMSCRIPTEN_BINDINGS(tests) {
23522365
23532366 function (" emval_test_return_vector" , &emval_test_return_vector);
23542367 function (" emval_test_return_vector_of_vectors" , &emval_test_return_vector_of_vectors);
2368+ function (" emval_test_return_vector_pointers" , &emval_test_return_vector_pointers);
23552369
23562370 register_vector<std::shared_ptr<StringHolder>>(" SharedPtrVector" );
23572371 function (" emval_test_return_shared_ptr_vector" , &emval_test_return_shared_ptr_vector);
@@ -2371,10 +2385,12 @@ EMSCRIPTEN_BINDINGS(tests) {
23712385 register_optional<int >();
23722386 register_optional<float >();
23732387 register_optional<SmallClass>();
2388+ register_optional<SmallClass*>();
23742389 register_optional<std::string>();
23752390 function (" embind_test_return_optional_int" , &embind_test_return_optional_int);
23762391 function (" embind_test_return_optional_float" , &embind_test_return_optional_float);
23772392 function (" embind_test_return_optional_small_class" , &embind_test_return_optional_small_class);
2393+ function (" embind_test_return_optional_small_class_pointer" , &embind_test_return_optional_small_class_pointer);
23782394 function (" embind_test_return_optional_string" , &embind_test_return_optional_string);
23792395 function (" embind_test_optional_int_arg" , &embind_test_optional_int_arg);
23802396 function (" embind_test_optional_float_arg" , &embind_test_optional_float_arg);
0 commit comments