fix Lib/std/std unordered containers

This commit is contained in:
Takashi Tamura 2017-01-26 11:42:07 +09:00
commit 9cb90982ee
5 changed files with 30 additions and 39 deletions

View file

@ -4,7 +4,7 @@
// operator--() and constructor(compare function) not available for unordered_
// types
//
#define SWIG_NO_REVERSE_ITERATOR_METHODS
%include <std_pair.i>
%include <std_container.i>
@ -22,8 +22,6 @@
}
iterator find(const key_type& x);
iterator lower_bound(const key_type& x);
iterator upper_bound(const key_type& x);
#endif
%enddef
@ -68,7 +66,7 @@
namespace std {
template<class _Key, class _Tp, class _Compare = std::less< _Key >,
template<class _Key, class _Tp, class _Hash = std::hash< _Key >, class _Pred = std::equal_to< _Key >,
class _Alloc = allocator<std::pair< const _Key, _Tp > > >
class unordered_map {
public:
@ -101,29 +99,28 @@ namespace std {
}
}
%fragment(SWIG_Traits_frag(std::unordered_map< _Key, _Tp, _Compare, _Alloc >), "header",
%fragment(SWIG_Traits_frag(std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >), "header",
fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >),
fragment="StdMapTraits") {
fragment="StdUnorderedMapTraits") {
namespace swig {
template <> struct traits<std::unordered_map< _Key, _Tp, _Compare, _Alloc > > {
template <> struct traits<std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > > {
typedef pointer_category category;
static const char* type_name() {
return "std::unordered_map<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >";
return "std::unordered_map<" #_Key "," #_Tp "," #_Hash "," #_Pred "," #_Alloc " >";
}
};
}
}
%typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::unordered_map< _Key, _Tp, _Compare, _Alloc >);
unordered_map( const _Compare& );
%typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >);
#ifdef %swig_unordered_map_methods
// Add swig/language extra methods
%swig_unordered_map_methods(std::unordered_map< _Key, _Tp, _Compare, _Alloc >);
%swig_unordered_map_methods(std::unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc >);
#endif
%std_unordered_map_methods(unordered_map);
};
}
#undef SWIG_NO_REVERSE_ITERATOR_METHODS