@@ -216,12 +216,22 @@ enum SwigMemFlags {
216
216
217
217
#define SWIG_check_nonnull (SWIG_CLASS_WRAPPER, TYPENAME, FNAME, FUNCNAME, RETURNNULL ) \
218
218
if (!(SWIG_CLASS_WRAPPER).cptr) { \
219
- SWIG_exception_impl (FUNCNAME, SWIG_TypeError , \
219
+ SWIG_exception_impl (FUNCNAME, SWIG_NullReferenceError , \
220
220
" Cannot pass null " TYPENAME " (class " FNAME " ) " \
221
221
" as a reference" , RETURNNULL); \
222
222
}
223
223
224
224
225
+ namespace swig {
226
+ enum AssignmentType {
227
+ ASSIGNMENT_DEFAULT,
228
+ ASSIGNMENT_NODESTRUCT,
229
+ ASSIGNMENT_SMARTPTR
230
+ };
231
+ }
232
+
233
+ #define SWIGPOLICY_std_mt19937_64 swig::ASSIGNMENT_DEFAULT
234
+
225
235
#include < stdexcept>
226
236
227
237
@@ -458,6 +468,123 @@ SWIGINTERN SwigClassWrapper SwigClassWrapper_uninitialized() {
458
468
return result;
459
469
}
460
470
471
+
472
+ namespace swig {
473
+
474
+ template <class T , AssignmentType A>
475
+ struct DestructorPolicy {
476
+ static SwigClassWrapper destroy (SwigClassWrapper self) {
477
+ delete static_cast <T*>(self.cptr );
478
+ return SwigClassWrapper_uninitialized ();
479
+ }
480
+ };
481
+ template <class T >
482
+ struct DestructorPolicy <T, ASSIGNMENT_NODESTRUCT> {
483
+ static SwigClassWrapper destroy (SwigClassWrapper) {
484
+ SWIG_exception_impl (" assignment" , SWIG_TypeError, " Invalid assignment: class type has private destructor" , return SwigClassWrapper_uninitialized ());
485
+ }
486
+ };
487
+ }
488
+
489
+
490
+ namespace swig {
491
+
492
+ SWIGINTERN SwigClassWrapper capture (SwigClassWrapper other) {
493
+ other.cmemflags &= ~SWIG_MEM_RVALUE;
494
+ return other;
495
+ }
496
+
497
+ template <class T , AssignmentType A>
498
+ struct AssignmentPolicy {
499
+ static SwigClassWrapper destroy (SwigClassWrapper self) {
500
+ return DestructorPolicy<T, A>::destroy (self);
501
+ }
502
+ static SwigClassWrapper alias (SwigClassWrapper other) {
503
+ SwigClassWrapper self = other;
504
+ self.cmemflags &= ~SWIG_MEM_OWN;
505
+ return self;
506
+ }
507
+ static SwigClassWrapper move_alias (SwigClassWrapper self, SwigClassWrapper other) {
508
+ if (self.cmemflags & SWIG_MEM_OWN) {
509
+ destroy (self);
510
+ }
511
+ return capture (other);
512
+ }
513
+ static SwigClassWrapper copy_alias (SwigClassWrapper self, SwigClassWrapper other) {
514
+ if (self.cmemflags & SWIG_MEM_OWN) {
515
+ destroy (self);
516
+ }
517
+ return capture (other);
518
+ }
519
+ };
520
+
521
+ template <class T >
522
+ struct AssignmentPolicy <T, ASSIGNMENT_SMARTPTR> {
523
+ static SwigClassWrapper destroy (SwigClassWrapper self) {
524
+ return DestructorPolicy<T, ASSIGNMENT_SMARTPTR>::destroy (self);
525
+ }
526
+ static SwigClassWrapper alias (SwigClassWrapper other) {
527
+ SwigClassWrapper self;
528
+ self.cptr = new T (*static_cast <T*>(other.cptr ));
529
+ self.cmemflags = other.cmemflags | SWIG_MEM_OWN;
530
+ return self;
531
+ }
532
+ static SwigClassWrapper move_alias (SwigClassWrapper self, SwigClassWrapper other) {
533
+ self = copy_alias (self, other);
534
+ self.cmemflags = other.cmemflags & ~SWIG_MEM_RVALUE;
535
+ destroy (other);
536
+ return self;
537
+ }
538
+ static SwigClassWrapper copy_alias (SwigClassWrapper self, SwigClassWrapper other) {
539
+ // LHS and RHS should both 'own' their shared pointers
540
+ T *pself = static_cast <T*>(self.cptr );
541
+ T *pother = static_cast <T*>(other.cptr );
542
+ *pself = *pother;
543
+ return self;
544
+ }
545
+ };
546
+
547
+ } // end namespace swig
548
+
549
+ template <class T , swig::AssignmentType A>
550
+ SWIGINTERN void SWIG_assign (SwigClassWrapper* self, SwigClassWrapper other) {
551
+ typedef swig::AssignmentPolicy<T, A> Policy_t;
552
+
553
+ if (self->cptr == NULL ) {
554
+ /* LHS is unassigned */
555
+ if (other.cmemflags & SWIG_MEM_RVALUE) {
556
+ /* Capture pointer from RHS, clear 'moving' flag */
557
+ *self = swig::capture (other);
558
+ } else {
559
+ /* Aliasing another class; clear ownership or copy smart pointer */
560
+ *self = Policy_t::alias (other);
561
+ }
562
+ } else if (other.cptr == NULL ) {
563
+ /* Replace LHS with a null pointer */
564
+ *self = Policy_t::destroy (*self);
565
+ } else if (self->cptr == other.cptr ) {
566
+ /* Self-assignment: ignore */
567
+ } else if (other.cmemflags & SWIG_MEM_RVALUE) {
568
+ /* Transferred ownership from a variable that's about to be lost.
569
+ * Move-assign and delete the transient data */
570
+ *self = Policy_t::move_alias (*self, other);
571
+ } else {
572
+ /* RHS shouldn't be deleted, alias to LHS */
573
+ *self = Policy_t::copy_alias (*self, other);
574
+ }
575
+ }
576
+
577
+ template <class T , swig::AssignmentType A>
578
+ SWIGINTERN void SWIG_free_rvalue (SwigClassWrapper other) {
579
+ typedef swig::AssignmentPolicy<T, A> Policy_t;
580
+ if (other.cmemflags & SWIG_MEM_RVALUE
581
+ && other.cmemflags & SWIG_MEM_OWN) {
582
+ /* We own *and* are being passed an expiring value */
583
+ Policy_t::destroy (other);
584
+ }
585
+ }
586
+
587
+
461
588
extern " C" {
462
589
SWIGEXPORT void _wrap_sort__SWIG_1 (SwigArrayWrapper *farg1) {
463
590
int32_t *arg1 = (int32_t *) 0 ;
@@ -1123,6 +1250,7 @@ SWIGEXPORT void _wrap_shuffle__SWIG_1(SwigClassWrapper *farg1, SwigArrayWrapper
1123
1250
arg2 = (int32_t *)farg2->data ;
1124
1251
arg3 = farg2->size ;
1125
1252
shuffle< int32_t >(*arg1,arg2,arg3);
1253
+ SWIG_free_rvalue< std::mt19937_64, SWIGPOLICY_std_mt19937_64 >(*farg1);
1126
1254
}
1127
1255
1128
1256
@@ -1136,6 +1264,7 @@ SWIGEXPORT void _wrap_shuffle__SWIG_2(SwigClassWrapper *farg1, SwigArrayWrapper
1136
1264
arg2 = (int64_t *)farg2->data ;
1137
1265
arg3 = farg2->size ;
1138
1266
shuffle< int64_t >(*arg1,arg2,arg3);
1267
+ SWIG_free_rvalue< std::mt19937_64, SWIGPOLICY_std_mt19937_64 >(*farg1);
1139
1268
}
1140
1269
1141
1270
@@ -1149,6 +1278,7 @@ SWIGEXPORT void _wrap_shuffle__SWIG_3(SwigClassWrapper *farg1, SwigArrayWrapper
1149
1278
arg2 = (double *)farg2->data ;
1150
1279
arg3 = farg2->size ;
1151
1280
shuffle< double >(*arg1,arg2,arg3);
1281
+ SWIG_free_rvalue< std::mt19937_64, SWIGPOLICY_std_mt19937_64 >(*farg1);
1152
1282
}
1153
1283
1154
1284
0 commit comments