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/SWIG@8907 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2665f5b765
commit
c3bb0f609c
2 changed files with 14 additions and 16 deletions
|
|
@ -12,8 +12,6 @@
|
|||
/* instantiate the required template specializations */
|
||||
namespace std {
|
||||
/* remember to instantiate the key,value pair! */
|
||||
%template() pair<std::string,double>;
|
||||
%template() pair<std::string,int>;
|
||||
%template(DoubleMap) map<std::string,double>;
|
||||
%template() map<std::string,int>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,20 +34,6 @@
|
|||
%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
|
||||
//
|
||||
|
|
@ -99,6 +85,20 @@ namespace std {
|
|||
%traits_swigtype(_Key);
|
||||
%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::pair<_Key, _Tp >),
|
||||
fragment="StdMapTraits") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue