Add std::unique support
Simple copy of current auto_ptr support (just suppport for functions returning std::unique_ptr). Closes #1722
This commit is contained in:
parent
1993b334a6
commit
299880e6a6
14 changed files with 443 additions and 15 deletions
27
Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb
Normal file
27
Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'cpp11_std_unique_ptr'
|
||||
|
||||
def gc_check(expected_count)
|
||||
# GC.start(full_mark: true, immediate_sweep: true)
|
||||
GC.start
|
||||
# GC is not reliably run, skip check
|
||||
# swig_assert_equal_simple(expected_count, Cpp11_std_unique_ptr::Klass::getTotal_count())
|
||||
end
|
||||
|
||||
k1 = Cpp11_std_unique_ptr::makeKlassUniquePtr("first")
|
||||
k2 = Cpp11_std_unique_ptr::makeKlassUniquePtr("second")
|
||||
swig_assert_equal_simple(2, Cpp11_std_unique_ptr::Klass::getTotal_count())
|
||||
|
||||
gc_check(2)
|
||||
k1 = nil
|
||||
gc_check(1)
|
||||
|
||||
swig_assert_equal_simple(k2.getLabel(), "second")
|
||||
gc_check(1)
|
||||
|
||||
k2 = nil
|
||||
gc_check(0)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue