diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2018-10-09 19:44:00 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2018-10-09 19:44:00 +0100 |
commit | ca287ae13b069ab0f8c914a81a615de77c34dbcc (patch) | |
tree | 80ac86edbdd77ad21c6dc6d27fc009ac4f3f280c /Lib/perl5 | |
parent | 220a735ec5797df0750ffc20998383fcbd22f828 (diff) | |
download | swig-ca287ae13b069ab0f8c914a81a615de77c34dbcc.tar.gz |
Add support for non-default compare template argument in std::map wrappers
Diffstat (limited to 'Lib/perl5')
-rw-r--r-- | Lib/perl5/std_map.i | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/perl5/std_map.i b/Lib/perl5/std_map.i index af49ed38e..ae7c26601 100644 --- a/Lib/perl5/std_map.i +++ b/Lib/perl5/std_map.i @@ -20,7 +20,7 @@ namespace std { - template<class K, class T> class map { + template<class K, class T, class C = std::less<K> > class map { // add typemaps here public: typedef size_t size_type; @@ -28,14 +28,14 @@ namespace std { typedef K key_type; typedef T mapped_type; map(); - map(const map<K,T> &); + map(const map< K, T, C > &); unsigned int size() const; bool empty() const; void clear(); %extend { const T& get(const K& key) throw (std::out_of_range) { - std::map< K, T >::iterator i = self->find(key); + std::map< K, T, C >::iterator i = self->find(key); if (i != self->end()) return i->second; else @@ -45,14 +45,14 @@ namespace std { (*self)[key] = x; } void del(const K& key) throw (std::out_of_range) { - std::map< K, T >::iterator i = self->find(key); + std::map< K, T, C >::iterator i = self->find(key); if (i != self->end()) self->erase(i); else throw std::out_of_range("key not found"); } bool has_key(const K& key) { - std::map< K, T >::iterator i = self->find(key); + std::map< K, T, C >::iterator i = self->find(key); return i != self->end(); } } |