diff --git a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java index 530008a87..750ec5067 100644 --- a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java +++ b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java @@ -33,7 +33,7 @@ public class li_boost_intrusive_ptr_runme { // Change loop count to run for a long time to monitor memory final int loopCount = 5000; //5000; for (int i=0; i #include #include -template void intrusive_ptr_add_ref(const T* r) { r->addref(); } -template void intrusive_ptr_release(const T* r) { r->release(); } - // Uncomment macro below to turn on intrusive_ptr memory leak checking as described above //#define INTRUSIVE_PTR_WRAPPER @@ -132,6 +135,8 @@ struct Klass { void release(void) const { if (--count == 0) delete this; } int use_count(void) const { return count; } static long getTotal_count() { return total_count; } + friend void intrusive_ptr_add_ref(const Klass* r) { r->addref(); } + friend void intrusive_ptr_release(const Klass* r) { r->release(); } private: static void increment() { ++total_count; if (debug_shared) cout << " ++xxxxx Klass::increment tot: " << total_count << endl;} @@ -177,6 +182,8 @@ struct IgnoredRefCountingBase { void addref(void) const { ++count; } void release(void) const { if (--count == 0) delete this; } int use_count(void) const { return count; } + inline friend void intrusive_ptr_add_ref(const IgnoredRefCountingBase* r) { r->addref(); } + inline friend void intrusive_ptr_release(const IgnoredRefCountingBase* r) { r->release(); } static long getTotal_count() { return total_count; } private: @@ -414,6 +421,8 @@ template struct Base { void addref(void) const { count++; } void release(void) const { if (--count == 0) delete this; } int use_count(void) const { return count; } + inline friend void intrusive_ptr_add_ref(const Base* r) { r->addref(); } + inline friend void intrusive_ptr_release(const Base* r) { r->release(); } }; %}