diff options
author | Takashi Tamura <tamuratak@users.noreply.github.com> | 2017-01-26 11:42:07 +0900 |
---|---|---|
committer | Takashi Tamura <tamuratak@users.noreply.github.com> | 2017-01-28 16:51:21 +0900 |
commit | 9cb90982ee98b437fd3fe9f1257b48b5eef9b335 (patch) | |
tree | 5c8805d9bbefddc3b82f87ef0e87def943bc9896 /Lib/std | |
parent | 2ab08e493f166e2c83e0e6faaeedfa1a222a6b79 (diff) | |
download | swig-9cb90982ee98b437fd3fe9f1257b48b5eef9b335.tar.gz |
fix Lib/std/std unordered containers
Diffstat (limited to 'Lib/std')
-rw-r--r-- | Lib/std/std_container.i | 10 | ||||
-rw-r--r-- | Lib/std/std_unordered_map.i | 21 | ||||
-rw-r--r-- | Lib/std/std_unordered_multimap.i | 21 | ||||
-rw-r--r-- | Lib/std/std_unordered_multiset.i | 15 | ||||
-rw-r--r-- | Lib/std/std_unordered_set.i | 2 |
5 files changed, 30 insertions, 39 deletions
diff --git a/Lib/std/std_container.i b/Lib/std/std_container.i index 000163f1e..5d0f1f545 100644 --- a/Lib/std/std_container.i +++ b/Lib/std/std_container.i @@ -26,19 +26,17 @@ class const_iterator; iterator begin(); iterator end(); - #endif - -%enddef - -%define %std_container_methods_reverse_iterators(container...) - #ifdef SWIG_EXPORT_ITERATOR_METHODS + #if !defined(SWIG_NO_REVERSE_ITERATOR_METHODS) class reverse_iterator; class const_reverse_iterator; reverse_iterator rbegin(); reverse_iterator rend(); #endif + #endif + + %enddef // Common container methods diff --git a/Lib/std/std_unordered_map.i b/Lib/std/std_unordered_map.i index 1cb714821..4795120d1 100644 --- a/Lib/std/std_unordered_map.i +++ b/Lib/std/std_unordered_map.i @@ -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 diff --git a/Lib/std/std_unordered_multimap.i b/Lib/std/std_unordered_multimap.i index 46b56d88a..8feab03a4 100644 --- a/Lib/std/std_unordered_multimap.i +++ b/Lib/std/std_unordered_multimap.i @@ -6,10 +6,10 @@ // %include <std_unordered_map.i> - +#define SWIG_NO_REVERSE_ITERATOR_METHODS %define %std_unordered_multimap_methods(mmap...) - %std_map_methods_common(mmap); + %std_unordered_map_methods_common(mmap); #ifdef SWIG_EXPORT_ITERATOR_METHODS std::pair<iterator,iterator> equal_range(const key_type& x); @@ -44,7 +44,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_multimap { public: @@ -63,28 +63,27 @@ namespace std { %traits_swigtype(_Key); %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >), "header", fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >), - fragment="StdMultimapTraits") { + fragment="StdUnorderedMultimapTraits") { namespace swig { - template <> struct traits<std::unordered_multimap< _Key, _Tp, _Compare, _Alloc > > { + template <> struct traits<std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > > { typedef pointer_category category; static const char* type_name() { - return "std::unordered_multimap<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >"; + return "std::unordered_multimap<" #_Key "," #_Tp "," #_Hash "," #_Pred "," #_Alloc " >"; } }; } } - %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >); - unordered_multimap( const _Compare& ); - #ifdef %swig_unordered_multimap_methods // Add swig/language extra methods - %swig_unordered_multimap_methods(std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >); + %swig_unordered_multimap_methods(std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >); #endif %std_unordered_multimap_methods(unordered_multimap); }; } +#undef SWIG_NO_REVERSE_ITERATOR_METHODS diff --git a/Lib/std/std_unordered_multiset.i b/Lib/std/std_unordered_multiset.i index 725ca2fe7..c0ada7e71 100644 --- a/Lib/std/std_unordered_multiset.i +++ b/Lib/std/std_unordered_multiset.i @@ -43,7 +43,8 @@ namespace std { //unordered_multiset - template <class _Key, class _Compare = std::less< _Key >, + template <class _Key, class _Hash = std::hash< _Key >, + class _Compare = std::equal_to< _Key >, class _Alloc = allocator< _Key > > class unordered_multiset { public: @@ -59,26 +60,24 @@ namespace std { %traits_swigtype(_Key); - %fragment(SWIG_Traits_frag(std::unordered_multiset< _Key, _Compare, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::unordered_multiset< _Key, _Hash, _Compare, _Alloc >), "header", fragment=SWIG_Traits_frag(_Key), fragment="StdMultisetTraits") { namespace swig { - template <> struct traits<std::unordered_multiset< _Key, _Compare, _Alloc > > { + template <> struct traits<std::unordered_multiset< _Key, _Hash, _Compare, _Alloc > > { typedef pointer_category category; static const char* type_name() { - return "std::unordered_multiset<" #_Key "," #_Compare "," #_Alloc " >"; + return "std::unordered_multiset<" #_Key "," #_Hash "," #_Compare "," #_Alloc " >"; } }; } } - %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::unordered_multiset< _Key, _Compare, _Alloc >); - - unordered_multiset( const _Compare& ); + %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::unordered_multiset< _Key, _Hash, _Compare, _Alloc >); #ifdef %swig_unordered_multiset_methods // Add swig/language extra methods - %swig_unordered_multiset_methods(std::unordered_multiset< _Key, _Compare, _Alloc >); + %swig_unordered_multiset_methods(std::unordered_multiset< _Key, _Hash, _Compare, _Alloc >); #endif %std_unordered_multiset_methods(unordered_multiset); diff --git a/Lib/std/std_unordered_set.i b/Lib/std/std_unordered_set.i index 98e792040..fb4415e1a 100644 --- a/Lib/std/std_unordered_set.i +++ b/Lib/std/std_unordered_set.i @@ -110,8 +110,6 @@ namespace std { %typemap_traits_ptr(SWIG_TYPECHECK_SET, std::unordered_set< _Key, _Hash, _Compare, _Alloc >); - unordered_set( const _Compare& ); - #ifdef %swig_unordered_set_methods // Add swig/language extra methods %swig_unordered_set_methods(std::unordered_set< _Key, _Hash, _Compare, _Alloc >); |