diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/java/std_unordered_set.i | 40 | ||||
-rw-r--r-- | Lib/python/std_unordered_multiset.i | 26 | ||||
-rw-r--r-- | Lib/python/std_unordered_set.i | 26 | ||||
-rw-r--r-- | Lib/ruby/std_unordered_multiset.i | 20 | ||||
-rw-r--r-- | Lib/ruby/std_unordered_set.i | 20 | ||||
-rw-r--r-- | Lib/std/std_unordered_multiset.i | 14 | ||||
-rw-r--r-- | Lib/std/std_unordered_set.i | 14 |
7 files changed, 80 insertions, 80 deletions
diff --git a/Lib/java/std_unordered_set.i b/Lib/java/std_unordered_set.i index 1a7b03688..59726e94d 100644 --- a/Lib/java/std_unordered_set.i +++ b/Lib/java/std_unordered_set.i @@ -43,12 +43,12 @@ namespace std { -template <class T> +template <class Key> class unordered_set { -%typemap(javabase) std::unordered_set<T> "java.util.AbstractSet<$typemap(jboxtype, T)>" +%typemap(javabase) std::unordered_set<Key> "java.util.AbstractSet<$typemap(jboxtype, Key)>" %proxycode %{ - public $javaclassname(java.util.Collection<? extends $typemap(jboxtype, T)> collection) { + public $javaclassname(java.util.Collection<? extends $typemap(jboxtype, Key)> collection) { this(); addAll(collection); } @@ -57,34 +57,34 @@ class unordered_set { return sizeImpl(); } - public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, T)> collection) { + public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, Key)> collection) { boolean didAddElement = false; for (java.lang.Object object : collection) { - didAddElement |= add(($typemap(jboxtype, T))object); + didAddElement |= add(($typemap(jboxtype, Key))object); } return didAddElement; } - public java.util.Iterator<$typemap(jboxtype, T)> iterator() { - return new java.util.Iterator<$typemap(jboxtype, T)>() { + public java.util.Iterator<$typemap(jboxtype, Key)> iterator() { + return new java.util.Iterator<$typemap(jboxtype, Key)>() { private Iterator curr; private Iterator end; - private java.util.Iterator<$typemap(jboxtype, T)> init() { + private java.util.Iterator<$typemap(jboxtype, Key)> init() { curr = $javaclassname.this.begin(); end = $javaclassname.this.end(); return this; } - public $typemap(jboxtype, T) next() { + public $typemap(jboxtype, Key) next() { if (!hasNext()) { throw new java.util.NoSuchElementException(); } // Save the current position, increment it, // then return the value at the position before the increment. - final $typemap(jboxtype, T) currValue = curr.derefUnchecked(); + final $typemap(jboxtype, Key) currValue = curr.derefUnchecked(); curr.incrementUnchecked(); return currValue; } @@ -106,11 +106,11 @@ class unordered_set { } public boolean contains(java.lang.Object object) { - if (!(object instanceof $typemap(jboxtype, T))) { + if (!(object instanceof $typemap(jboxtype, Key))) { return false; } - return containsImpl(($typemap(jboxtype, T))object); + return containsImpl(($typemap(jboxtype, Key))object); } public boolean removeAll(java.util.Collection<?> collection) { @@ -123,11 +123,11 @@ class unordered_set { } public boolean remove(java.lang.Object object) { - if (!(object instanceof $typemap(jboxtype, T))) { + if (!(object instanceof $typemap(jboxtype, Key))) { return false; } - return removeImpl(($typemap(jboxtype, T))object); + return removeImpl(($typemap(jboxtype, Key))object); } %} @@ -140,7 +140,7 @@ class unordered_set { ++(*$self); } - T derefUnchecked() const { + Key derefUnchecked() const { return **$self; } @@ -152,8 +152,8 @@ class unordered_set { typedef size_t size_type; typedef ptrdiff_t difference_type; - typedef T value_type; - typedef T key_type; + typedef Key value_type; + typedef Key key_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; @@ -172,17 +172,17 @@ class unordered_set { %fragment("SWIG_UnorderedSetSize"); // Returns whether item was inserted. - bool add(const T& key) { + bool add(const Key& key) { return self->insert(key).second; } // Returns whether set contains key. - bool containsImpl(const T& key) { + bool containsImpl(const Key& key) { return (self->count(key) > 0); } // Returns whether the item was erased. - bool removeImpl(const T& key) { + bool removeImpl(const Key& key) { return (self->erase(key) > 0); } diff --git a/Lib/python/std_unordered_multiset.i b/Lib/python/std_unordered_multiset.i index d90a97bdc..4b67c7305 100644 --- a/Lib/python/std_unordered_multiset.i +++ b/Lib/python/std_unordered_multiset.i @@ -7,9 +7,9 @@ %fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template <class SwigPySeq, class T> + template <class SwigPySeq, class Key> inline void - assign(const SwigPySeq& swigpyseq, std::unordered_multiset<T>* seq) { + assign(const SwigPySeq& swigpyseq, std::unordered_multiset<Key>* seq) { // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented typedef typename SwigPySeq::value_type value_type; typename SwigPySeq::const_iterator it = swigpyseq.begin(); @@ -18,24 +18,24 @@ } } - template <class T> - struct traits_reserve<std::unordered_multiset<T> > { - static void reserve(std::unordered_multiset<T> &seq, typename std::unordered_multiset<T>::size_type n) { + template <class Key> + struct traits_reserve<std::unordered_multiset<Key> > { + static void reserve(std::unordered_multiset<Key> &seq, typename std::unordered_multiset<Key>::size_type n) { seq.reserve(n); } }; - template <class T> - struct traits_asptr<std::unordered_multiset<T> > { - static int asptr(PyObject *obj, std::unordered_multiset<T> **m) { - return traits_asptr_stdseq<std::unordered_multiset<T> >::asptr(obj, m); + template <class Key> + struct traits_asptr<std::unordered_multiset<Key> > { + static int asptr(PyObject *obj, std::unordered_multiset<Key> **m) { + return traits_asptr_stdseq<std::unordered_multiset<Key> >::asptr(obj, m); } }; - template <class T> - struct traits_from<std::unordered_multiset<T> > { - static PyObject *from(const std::unordered_multiset<T>& vec) { - return traits_from_stdseq<std::unordered_multiset<T> >::from(vec); + template <class Key> + struct traits_from<std::unordered_multiset<Key> > { + static PyObject *from(const std::unordered_multiset<Key>& vec) { + return traits_from_stdseq<std::unordered_multiset<Key> >::from(vec); } }; } diff --git a/Lib/python/std_unordered_set.i b/Lib/python/std_unordered_set.i index 8736cb1b5..9eab62226 100644 --- a/Lib/python/std_unordered_set.i +++ b/Lib/python/std_unordered_set.i @@ -5,9 +5,9 @@ %fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits") %{ namespace swig { - template <class SwigPySeq, class T> + template <class SwigPySeq, class Key> inline void - assign(const SwigPySeq& swigpyseq, std::unordered_set<T>* seq) { + assign(const SwigPySeq& swigpyseq, std::unordered_set<Key>* seq) { // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented typedef typename SwigPySeq::value_type value_type; typename SwigPySeq::const_iterator it = swigpyseq.begin(); @@ -16,24 +16,24 @@ } } - template <class T> - struct traits_reserve<std::unordered_set<T> > { - static void reserve(std::unordered_set<T> &seq, typename std::unordered_set<T>::size_type n) { + template <class Key> + struct traits_reserve<std::unordered_set<Key> > { + static void reserve(std::unordered_set<Key> &seq, typename std::unordered_set<Key>::size_type n) { seq.reserve(n); } }; - template <class T> - struct traits_asptr<std::unordered_set<T> > { - static int asptr(PyObject *obj, std::unordered_set<T> **s) { - return traits_asptr_stdseq<std::unordered_set<T> >::asptr(obj, s); + template <class Key> + struct traits_asptr<std::unordered_set<Key> > { + static int asptr(PyObject *obj, std::unordered_set<Key> **s) { + return traits_asptr_stdseq<std::unordered_set<Key> >::asptr(obj, s); } }; - template <class T> - struct traits_from<std::unordered_set<T> > { - static PyObject *from(const std::unordered_set<T>& vec) { - return traits_from_stdseq<std::unordered_set<T> >::from(vec); + template <class Key> + struct traits_from<std::unordered_set<Key> > { + static PyObject *from(const std::unordered_set<Key>& vec) { + return traits_from_stdseq<std::unordered_set<Key> >::from(vec); } }; } diff --git a/Lib/ruby/std_unordered_multiset.i b/Lib/ruby/std_unordered_multiset.i index 181aa212d..4bc13790a 100644 --- a/Lib/ruby/std_unordered_multiset.i +++ b/Lib/ruby/std_unordered_multiset.i @@ -7,9 +7,9 @@ %fragment("StdUnorderedMultisetTraits","header",fragment="StdUnorderedSetTraits") %{ namespace swig { - template <class RubySeq, class T> + template <class RubySeq, class Key> inline void - assign(const RubySeq& rubyseq, std::unordered_multiset<T>* seq) { + assign(const RubySeq& rubyseq, std::unordered_multiset<Key>* seq) { // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented typedef typename RubySeq::value_type value_type; typename RubySeq::const_iterator it = rubyseq.begin(); @@ -18,17 +18,17 @@ } } - template <class T> - struct traits_asptr<std::unordered_multiset<T> > { - static int asptr(VALUE obj, std::unordered_multiset<T> **m) { - return traits_asptr_stdseq<std::unordered_multiset<T> >::asptr(obj, m); + template <class Key> + struct traits_asptr<std::unordered_multiset<Key> > { + static int asptr(VALUE obj, std::unordered_multiset<Key> **m) { + return traits_asptr_stdseq<std::unordered_multiset<Key> >::asptr(obj, m); } }; - template <class T> - struct traits_from<std::unordered_multiset<T> > { - static VALUE from(const std::unordered_multiset<T>& vec) { - return traits_from_stdseq<std::unordered_multiset<T> >::from(vec); + template <class Key> + struct traits_from<std::unordered_multiset<Key> > { + static VALUE from(const std::unordered_multiset<Key>& vec) { + return traits_from_stdseq<std::unordered_multiset<Key> >::from(vec); } }; } diff --git a/Lib/ruby/std_unordered_set.i b/Lib/ruby/std_unordered_set.i index 3d4494351..84d3b4b09 100644 --- a/Lib/ruby/std_unordered_set.i +++ b/Lib/ruby/std_unordered_set.i @@ -7,9 +7,9 @@ %fragment("StdUnorderedSetTraits","header",fragment="<stddef.h>",fragment="StdSetTraits") %{ namespace swig { - template <class RubySeq, class T> + template <class RubySeq, class Key> inline void - assign(const RubySeq& rubyseq, std::unordered_set<T>* seq) { + assign(const RubySeq& rubyseq, std::unordered_set<Key>* seq) { // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented typedef typename RubySeq::value_type value_type; typename RubySeq::const_iterator it = rubyseq.begin(); @@ -18,17 +18,17 @@ } } - template <class T> - struct traits_asptr<std::unordered_set<T> > { - static int asptr(VALUE obj, std::unordered_set<T> **s) { - return traits_asptr_stdseq<std::unordered_set<T> >::asptr(obj, s); + template <class Key> + struct traits_asptr<std::unordered_set<Key> > { + static int asptr(VALUE obj, std::unordered_set<Key> **s) { + return traits_asptr_stdseq<std::unordered_set<Key> >::asptr(obj, s); } }; - template <class T> - struct traits_from<std::unordered_set<T> > { - static VALUE from(const std::unordered_set<T>& vec) { - return traits_from_stdseq<std::unordered_set<T> >::from(vec); + template <class Key> + struct traits_from<std::unordered_set<Key> > { + static VALUE from(const std::unordered_set<Key>& vec) { + return traits_from_stdseq<std::unordered_set<Key> >::from(vec); } }; } diff --git a/Lib/std/std_unordered_multiset.i b/Lib/std/std_unordered_multiset.i index 1817fc24a..8effa586e 100644 --- a/Lib/std/std_unordered_multiset.i +++ b/Lib/std/std_unordered_multiset.i @@ -17,19 +17,19 @@ // const declarations are used to guess the intent of the function being // exported; therefore, the following rationale is applied: // -// -- f(std::unordered_multiset<T>), f(const std::unordered_multiset<T>&): +// -- f(std::unordered_multiset<Key>), f(const std::unordered_multiset<Key>&): // the parameter being read-only, either a sequence or a -// previously wrapped std::unordered_multiset<T> can be passed. -// -- f(std::unordered_multiset<T>&), f(std::unordered_multiset<T>*): +// previously wrapped std::unordered_multiset<Key> can be passed. +// -- f(std::unordered_multiset<Key>&), f(std::unordered_multiset<Key>*): // the parameter may be modified; therefore, only a wrapped std::unordered_multiset // can be passed. -// -- std::unordered_multiset<T> f(), const std::unordered_multiset<T>& f(): -// the set is returned by copy; therefore, a sequence of T:s +// -- std::unordered_multiset<Key> f(), const std::unordered_multiset<Key>& f(): +// the set is returned by copy; therefore, a sequence of Key:s // is returned which is most easily used in other functions -// -- std::unordered_multiset<T>& f(), std::unordered_multiset<T>* f(): +// -- std::unordered_multiset<Key>& f(), std::unordered_multiset<Key>* f(): // the set is returned by reference; therefore, a wrapped std::unordered_multiset // is returned -// -- const std::unordered_multiset<T>* f(), f(const std::unordered_multiset<T>*): +// -- const std::unordered_multiset<Key>* f(), f(const std::unordered_multiset<Key>*): // for consistency, they expect and return a plain set pointer. // ------------------------------------------------------------------------ diff --git a/Lib/std/std_unordered_set.i b/Lib/std/std_unordered_set.i index 133246da8..d7fc24a22 100644 --- a/Lib/std/std_unordered_set.i +++ b/Lib/std/std_unordered_set.i @@ -50,19 +50,19 @@ // const declarations are used to guess the intent of the function being // exported; therefore, the following rationale is applied: // -// -- f(std::unordered_set<T>), f(const std::unordered_set<T>&): +// -- f(std::unordered_set<Key>), f(const std::unordered_set<Key>&): // the parameter being read-only, either a sequence or a -// previously wrapped std::unordered_set<T> can be passed. -// -- f(std::unordered_set<T>&), f(std::unordered_set<T>*): +// previously wrapped std::unordered_set<Key> can be passed. +// -- f(std::unordered_set<Key>&), f(std::unordered_set<Key>*): // the parameter may be modified; therefore, only a wrapped std::unordered_set // can be passed. -// -- std::unordered_set<T> f(), const std::unordered_set<T>& f(): -// the unordered_set is returned by copy; therefore, a sequence of T:s +// -- std::unordered_set<Key> f(), const std::unordered_set<Key>& f(): +// the unordered_set is returned by copy; therefore, a sequence of Key:s // is returned which is most easily used in other functions -// -- std::unordered_set<T>& f(), std::unordered_set<T>* f(): +// -- std::unordered_set<Key>& f(), std::unordered_set<Key>* f(): // the unordered_set is returned by reference; therefore, a wrapped std::unordered_set // is returned -// -- const std::unordered_set<T>* f(), f(const std::unordered_set<T>*): +// -- const std::unordered_set<Key>* f(), f(const std::unordered_set<Key>*): // for consistency, they expect and return a plain unordered_set pointer. // ------------------------------------------------------------------------ |