Add unordered_{set|map} and set to Java
Add test suite Add to makefile Revert set change Fix java map test Fix some of the tests Fix unordered map test
This commit is contained in:
parent
902f3f0ac5
commit
0f18b430fb
11 changed files with 481 additions and 12 deletions
47
Lib/java/std_unordered_set.i
Normal file
47
Lib/java/std_unordered_set.i
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_unordered_set.i
|
||||
*
|
||||
* SWIG typemaps for std::unordered_set
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <std_common.i>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// std::unordered_set
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <unordered_set>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
template <class KeyType>
|
||||
class unordered_set {
|
||||
public:
|
||||
unordered_set();
|
||||
unordered_set(const unordered_set<KeyType>&);
|
||||
|
||||
unsigned int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
|
||||
%extend {
|
||||
// Returns whether item was inserted.
|
||||
bool insert(const KeyType& key) {
|
||||
return self->insert(key).second;
|
||||
}
|
||||
|
||||
// Returns whether set contains key.
|
||||
bool has(const KeyType& key) {
|
||||
return (self->count(key) > 0);
|
||||
}
|
||||
|
||||
// Returns whether the item was erased.
|
||||
bool erase(const KeyType& key) {
|
||||
return (self->erase(key) > 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
Loading…
Add table
Add a link
Reference in a new issue