Add STL container copy constructors where missing

Also provide consistent copy constructor declarations.
This commit is contained in:
William S Fulton 2019-02-14 18:53:05 +00:00
commit 6d27ead9c0
36 changed files with 72 additions and 43 deletions

View file

@ -40,9 +40,8 @@ namespace std{
list(); list();
list(unsigned int size, const T& value = T()); list(unsigned int size, const T& value = T());
list(const list<T> &other); list(const list& other);
~list();
void assign(unsigned int n, const T& value); void assign(unsigned int n, const T& value);
void swap(list<T> &x); void swap(list<T> &x);

View file

@ -221,7 +221,7 @@
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C > &other); map(const map& other);
size_type size() const; size_type size() const;
bool empty() const; bool empty() const;
%rename(Clear) clear; %rename(Clear) clear;

View file

@ -217,8 +217,10 @@
void reserve(size_type n); void reserve(size_type n);
%newobject GetRange(int index, int count); %newobject GetRange(int index, int count);
%newobject Repeat(CTYPE const& value, int count); %newobject Repeat(CTYPE const& value, int count);
vector(); vector();
vector(const vector &other); vector(const vector &other);
%extend { %extend {
vector(int capacity) throw (std::out_of_range) { vector(int capacity) throw (std::out_of_range) {
std::vector< CTYPE >* pv = 0; std::vector< CTYPE >* pv = 0;

View file

@ -30,7 +30,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -116,8 +116,10 @@ public void capacity(size_t value) {
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n) throw (std::length_error); void reserve(size_type n) throw (std::length_error);
vector(); vector();
vector(const vector &other); vector(const vector &other);
%extend { %extend {
vector(size_type capacity) throw (std::length_error) { vector(size_type capacity) throw (std::length_error) {
std::vector< CTYPE >* pv = 0; std::vector< CTYPE >* pv = 0;
@ -461,8 +463,10 @@ int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg)
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n) throw (std::length_error); void reserve(size_type n) throw (std::length_error);
vector(); vector();
vector(const vector &other); vector(const vector &other);
%extend { %extend {
vector(size_type capacity) throw (std::length_error) { vector(size_type capacity) throw (std::length_error) {
std::vector< CTYPE >* pv = 0; std::vector< CTYPE >* pv = 0;

View file

@ -21,6 +21,8 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
list(); list();
list(const list& other);
size_type size() const; size_type size() const;
bool empty() const; bool empty() const;
%rename(isEmpty) empty; %rename(isEmpty) empty;

View file

@ -34,7 +34,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -21,6 +21,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);
@ -60,6 +62,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);

View file

@ -225,7 +225,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -451,7 +451,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -667,7 +667,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -885,7 +885,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -197,7 +197,8 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector<T>& other); vector(const vector& other);
%rename(length) size; %rename(length) size;
unsigned int size() const; unsigned int size() const;
%rename("empty?") empty; %rename("empty?") empty;
@ -369,7 +370,8 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector<T>& other); vector(const vector& other);
%rename(length) size; %rename(length) size;
unsigned int size() const; unsigned int size() const;
%rename("empty?") empty; %rename("empty?") empty;

View file

@ -177,7 +177,8 @@ namespace std {
}; };
list(); list();
list(const list &other); list(const list& other);
%rename(isEmpty) empty; %rename(isEmpty) empty;
bool empty() const; bool empty() const;
void clear(); void clear();

View file

@ -153,7 +153,7 @@ template<class KeyType, class MappedType, class Comparator = std::less<KeyType>
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map<KeyType, MappedType, Comparator >& other); map(const map& other);
struct iterator { struct iterator {
%typemap(javaclassmodifiers) iterator "protected class" %typemap(javaclassmodifiers) iterator "protected class"

View file

@ -160,7 +160,7 @@ class set {
typedef const value_type& const_reference; typedef const value_type& const_reference;
set(); set();
set(const set<T>& other); set(const set& other);
%rename(isEmpty) empty; %rename(isEmpty) empty;
bool empty() const; bool empty() const;

View file

@ -153,7 +153,7 @@ template<class KeyType, class MappedType > class unordered_map {
typedef const value_type& const_reference; typedef const value_type& const_reference;
unordered_map(); unordered_map();
unordered_map(const unordered_map<KeyType, MappedType >& other); unordered_map(const unordered_map& other);
struct iterator { struct iterator {
%typemap(javaclassmodifiers) iterator "protected class" %typemap(javaclassmodifiers) iterator "protected class"

View file

@ -160,7 +160,7 @@ class unordered_set {
typedef const value_type& const_reference; typedef const value_type& const_reference;
unordered_set(); unordered_set();
unordered_set(const unordered_set<T>& other); unordered_set(const unordered_set& other);
%rename(isEmpty) empty; %rename(isEmpty) empty;
bool empty() const; bool empty() const;

View file

@ -86,6 +86,7 @@ SWIGINTERN jint SWIG_VectorSize(size_t size) {
vector(); vector();
vector(const vector &other); vector(const vector &other);
size_type capacity() const; size_type capacity() const;
void reserve(size_type n) throw (std::length_error); void reserve(size_type n) throw (std::length_error);
%rename(isEmpty) empty; %rename(isEmpty) empty;

View file

@ -35,7 +35,7 @@ namespace std {
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -23,6 +23,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);
@ -60,9 +62,10 @@ namespace std {
typedef value_type& reference; typedef value_type& reference;
typedef bool const_reference; typedef bool const_reference;
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);

View file

@ -34,7 +34,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -23,6 +23,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);
@ -62,6 +64,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);

View file

@ -34,7 +34,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -37,6 +37,7 @@ namespace std {
vector(unsigned int); vector(unsigned int);
vector(const vector& other); vector(const vector& other);
vector(unsigned int,T); vector(unsigned int,T);
unsigned int size() const; unsigned int size() const;
unsigned int max_size() const; unsigned int max_size() const;
bool empty() const; bool empty() const;

View file

@ -228,7 +228,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -458,7 +458,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -680,7 +680,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -902,7 +902,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -199,7 +199,8 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector<T>& other); vector(const vector& other);
%rename(length) size; %rename(length) size;
unsigned int size() const; unsigned int size() const;
%rename("empty?") empty; %rename("empty?") empty;
@ -383,7 +384,8 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector<T>& other); vector(const vector& other);
%rename(length) size; %rename(length) size;
unsigned int size() const; unsigned int size() const;
%rename("empty?") empty; %rename("empty?") empty;

View file

@ -29,9 +29,8 @@ namespace std {
list(); list();
list(unsigned int size, const T& value = T()); list(unsigned int size, const T& value = T());
list(const list<T>& other); list(const list& other);
~list();
void assign(unsigned int n, const T& value); void assign(unsigned int n, const T& value);
void swap(list<T> &x); void swap(list<T> &x);

View file

@ -33,7 +33,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -51,7 +51,8 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector<T>& other); vector(const vector& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
void clear(); void clear();

View file

@ -197,7 +197,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
list(); list();
list(const list<T>& other); list(const list& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -350,7 +350,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
list(); list();
list(const list<T>& other); list(const list& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -34,7 +34,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -190,7 +190,7 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector<T>& other); vector(const vector& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -367,7 +367,7 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, T *value); vector(unsigned int size, T *value);
vector(const vector<T *>& other); vector(const vector& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -543,7 +543,7 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, T value); vector(unsigned int size, T value);
vector(const vector<T>& other); vector(const vector& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -34,7 +34,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
void clear(); void clear();

View file

@ -23,6 +23,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);
@ -70,6 +72,8 @@ namespace std {
vector(); vector();
vector(size_type n); vector(size_type n);
vector(const vector& other);
size_type size() const; size_type size() const;
size_type capacity() const; size_type capacity() const;
void reserve(size_type n); void reserve(size_type n);

View file

@ -33,7 +33,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -28,8 +28,8 @@ namespace std {
carray() { } carray() { }
carray(const carray& c) { carray(const carray& other) {
std::copy(c.v, c.v + size(), v); std::copy(other.v, other.v + size(), v);
} }
template <class _Iterator> template <class _Iterator>

View file

@ -33,7 +33,7 @@ namespace std {
typedef const value_type& const_reference; typedef const value_type& const_reference;
map(); map();
map(const map< K, T, C >& other); map(const map& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;

View file

@ -218,7 +218,7 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector< T >& other); vector(const vector& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;
@ -377,7 +377,7 @@ namespace std {
vector(unsigned int size = 0); vector(unsigned int size = 0);
vector(unsigned int size, const T& value); vector(unsigned int size, const T& value);
vector(const vector< T >& other); vector(const vector& other);
unsigned int size() const; unsigned int size() const;
bool empty() const; bool empty() const;