fix std_map such that is not necessary to use %template() std::pair<xx,yy> everytime
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8907 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3c1f88e225
commit
b672cccec3
2 changed files with 14 additions and 16 deletions
|
|
@ -12,8 +12,6 @@
|
||||||
/* instantiate the required template specializations */
|
/* instantiate the required template specializations */
|
||||||
namespace std {
|
namespace std {
|
||||||
/* remember to instantiate the key,value pair! */
|
/* remember to instantiate the key,value pair! */
|
||||||
%template() pair<std::string,double>;
|
|
||||||
%template() pair<std::string,int>;
|
|
||||||
%template(DoubleMap) map<std::string,double>;
|
%template(DoubleMap) map<std::string,double>;
|
||||||
%template() map<std::string,int>;
|
%template() map<std::string,int>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,20 +34,6 @@
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
// **** Note ****
|
|
||||||
//
|
|
||||||
// If you are going to use a map, you need to instantiate both the
|
|
||||||
// map and the pair class:
|
|
||||||
//
|
|
||||||
// %template(pair_ii) std::pair<int, int>;
|
|
||||||
// %template(map_ii) std::map<int, int>;
|
|
||||||
//
|
|
||||||
// or
|
|
||||||
//
|
|
||||||
// %template() std::pair<int, int>;
|
|
||||||
// %template(map_ii) std::map<int, int>;
|
|
||||||
//
|
|
||||||
// **** Note ****
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// std::map
|
// std::map
|
||||||
//
|
//
|
||||||
|
|
@ -99,6 +85,20 @@ namespace std {
|
||||||
%traits_swigtype(_Key);
|
%traits_swigtype(_Key);
|
||||||
%traits_swigtype(_Tp);
|
%traits_swigtype(_Tp);
|
||||||
|
|
||||||
|
%fragment(SWIG_Traits_frag(std::pair< _Key, _Tp >), "header",
|
||||||
|
fragment=SWIG_Traits_frag(_Key),
|
||||||
|
fragment=SWIG_Traits_frag(_Tp),
|
||||||
|
fragment="StdPairTraits") {
|
||||||
|
namespace swig {
|
||||||
|
template <> struct traits<std::pair< _Key, _Tp > > {
|
||||||
|
typedef pointer_category category;
|
||||||
|
static const char* type_name() {
|
||||||
|
return "std::pair<" #_Key "," #_Tp " >";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%fragment(SWIG_Traits_frag(std::map<_Key, _Tp, _Compare, _Alloc >), "header",
|
%fragment(SWIG_Traits_frag(std::map<_Key, _Tp, _Compare, _Alloc >), "header",
|
||||||
fragment=SWIG_Traits_frag(std::pair<_Key, _Tp >),
|
fragment=SWIG_Traits_frag(std::pair<_Key, _Tp >),
|
||||||
fragment="StdMapTraits") {
|
fragment="StdMapTraits") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue