c++ - How to Use SWIG for STL Maps? -
i using swig ruby. can use swig generate wrappers map using
%include <std_map.i> %template(intmap) std::map<int,int>;
this in interface file. example of usage
2.2.1 :001 > = example::intmap.new => std::map,std::allocator< std::pair< int const,int > > > {} 2.2.1 :002 > a[1] = 2 => 2 2.2.1 :003 > a[6] = -12 => -12 2.2.1 :004 > a[4] = 92 => 92 2.2.1 :005 > => std::map,std::allocator< std::pair< int const,int > > > {1=>2,4=>92,6=>-12}
is there way define data type directly ruby type of key , value associated defined ruby ? example
2.2.1 :002 > b["asr"] = 2 => 2 2.2.1 :003 > b["tee"] = -12 => -12 2.2.1 :004 > b["wetwe"] = 92
use in interface file
%include <std_map.i> namespace std { %template(imap) map<swig::gc_value, swig::gc_value>; }
Comments
Post a Comment