@@ -1309,6 +1309,12 @@ std::vector<std::shared_ptr<StringHolder>> emval_test_return_shared_ptr_vector()
1309
1309
return sharedStrVector;
1310
1310
}
1311
1311
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
+
1312
1318
void test_string_with_vec (const std::string& p1, std::vector<std::string>& v1) {
1313
1319
// THIS DOES NOT WORK -- need to get as val and then call vecFromJSArray
1314
1320
printf (" %s\n " , p1.c_str ());
@@ -1339,6 +1345,12 @@ std::optional<SmallClass> embind_test_return_optional_small_class(bool create) {
1339
1345
}
1340
1346
return {};
1341
1347
}
1348
+ std::optional<SmallClass*> embind_test_return_optional_small_class_pointer (bool create) {
1349
+ if (create) {
1350
+ return new SmallClass ();
1351
+ }
1352
+ return {};
1353
+ }
1342
1354
1343
1355
int embind_test_optional_int_arg (std::optional<int > arg) {
1344
1356
if (arg) {
@@ -1885,6 +1897,7 @@ EMSCRIPTEN_BINDINGS(tests) {
1885
1897
register_vector<emscripten::val>(" EmValVector" );
1886
1898
register_vector<float >(" FloatVector" );
1887
1899
register_vector<std::vector<int >>(" IntegerVectorVector" );
1900
+ register_vector<SmallClass*>(" SmallClassPointerVector" );
1888
1901
1889
1902
class_<DummyForPointer>(" DummyForPointer" );
1890
1903
@@ -2352,6 +2365,7 @@ EMSCRIPTEN_BINDINGS(tests) {
2352
2365
2353
2366
function (" emval_test_return_vector" , &emval_test_return_vector);
2354
2367
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);
2355
2369
2356
2370
register_vector<std::shared_ptr<StringHolder>>(" SharedPtrVector" );
2357
2371
function (" emval_test_return_shared_ptr_vector" , &emval_test_return_shared_ptr_vector);
@@ -2371,10 +2385,12 @@ EMSCRIPTEN_BINDINGS(tests) {
2371
2385
register_optional<int >();
2372
2386
register_optional<float >();
2373
2387
register_optional<SmallClass>();
2388
+ register_optional<SmallClass*>();
2374
2389
register_optional<std::string>();
2375
2390
function (" embind_test_return_optional_int" , &embind_test_return_optional_int);
2376
2391
function (" embind_test_return_optional_float" , &embind_test_return_optional_float);
2377
2392
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);
2378
2394
function (" embind_test_return_optional_string" , &embind_test_return_optional_string);
2379
2395
function (" embind_test_optional_int_arg" , &embind_test_optional_int_arg);
2380
2396
function (" embind_test_optional_float_arg" , &embind_test_optional_float_arg);
0 commit comments