From 440264e4797b0941f410dbfe6385285dd0daa20b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 14 Feb 2019 07:31:21 +0000 Subject: [PATCH] Add missing typedefs to std::list + typedef corrections Numerous missing typedefs added. std::list::const_reference and std::list::reference specialization typedef fixes. --- Lib/allegrocl/std_list.i | 25 +++++++++++++------------ Lib/go/std_list.i | 5 ++--- Lib/java/std_list.i | 6 +++++- Lib/ocaml/std_list.i | 27 +++++++++++++-------------- Lib/perl5/std_list.i | 4 ++++ Lib/std/std_list.i | 4 ++-- 6 files changed, 39 insertions(+), 32 deletions(-) diff --git a/Lib/allegrocl/std_list.i b/Lib/allegrocl/std_list.i index 332691de1..26472156f 100644 --- a/Lib/allegrocl/std_list.i +++ b/Lib/allegrocl/std_list.i @@ -28,12 +28,16 @@ namespace std{ template class list { public: - - typedef T &reference; - typedef const T& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; typedef T &iterator; typedef const T& const_iterator; - + list(); list(unsigned int size, const T& value = T()); list(const list &other); @@ -46,21 +50,20 @@ namespace std{ const_reference back(); const_iterator begin(); const_iterator end(); - + void resize(unsigned int n, T c = T()); bool empty() const; void push_front(const T& INPUT); void push_back(const T& INPUT); - void pop_front(); void pop_back(); void clear(); unsigned int size() const; unsigned int max_size() const; void resize(unsigned int n, const T& INPUT); - + void remove(const T& INPUT); void unique(); void reverse(); @@ -153,7 +156,7 @@ namespace std{ if (j<0) j += size; if (i<0) i = 0; if (j>size) j = size; - + for (int k=0;ksize) j = size; - + for (int k=0;kinsert(self->end(),v.begin(),v.end()); } - } unsigned int __len__() { @@ -218,8 +220,7 @@ namespace std{ { self->pop_back(); } - - }; + } }; } diff --git a/Lib/go/std_list.i b/Lib/go/std_list.i index e0262331e..b6e9b6a5a 100644 --- a/Lib/go/std_list.i +++ b/Lib/go/std_list.i @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * std_vector.i + * std_list.i * ----------------------------------------------------------------------------- */ %{ @@ -9,7 +9,7 @@ namespace std { - template > + template class list { public: typedef size_t size_type; @@ -19,7 +19,6 @@ namespace std { typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; - typedef Alloc allocator_type; list(); size_type size() const; diff --git a/Lib/java/std_list.i b/Lib/java/std_list.i index 595db8919..516a36ee3 100644 --- a/Lib/java/std_list.i +++ b/Lib/java/std_list.i @@ -130,8 +130,12 @@ namespace std { public: typedef size_t size_type; + typedef ptrdiff_t difference_type; typedef T value_type; - typedef T &reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; /* * We'd actually be better off having the nested class *not* be static in the wrapper diff --git a/Lib/ocaml/std_list.i b/Lib/ocaml/std_list.i index cb648d711..e173d8b1e 100644 --- a/Lib/ocaml/std_list.i +++ b/Lib/ocaml/std_list.i @@ -13,16 +13,20 @@ %} -namespace std{ +namespace std { template class list { public: - - typedef T &reference; - typedef const T& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; typedef T &iterator; typedef const T& const_iterator; - + list(); list(unsigned int size, const T& value = T()); list(const list& other); @@ -35,28 +39,25 @@ namespace std{ const_reference back(); const_iterator begin(); const_iterator end(); - + void resize(unsigned int n, T c = T()); bool empty() const; void push_front(const T& x); void push_back(const T& x); - void pop_front(); void pop_back(); void clear(); unsigned int size() const; unsigned int max_size() const; void resize(unsigned int n, const T& value); - + void remove(const T& value); void unique(); void reverse(); void sort(); - - - + %extend { const_reference __getitem__(int i) throw (std::out_of_range) @@ -206,9 +207,7 @@ namespace std{ { self->pop_back(); } - - }; - + } }; } diff --git a/Lib/perl5/std_list.i b/Lib/perl5/std_list.i index 8e2945fba..d42e3d8ef 100644 --- a/Lib/perl5/std_list.i +++ b/Lib/perl5/std_list.i @@ -189,7 +189,11 @@ namespace std { } public: typedef size_t size_type; + typedef ptrdiff_t difference_type; typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; typedef const value_type& const_reference; list(); diff --git a/Lib/std/std_list.i b/Lib/std/std_list.i index ebbafa22b..2cc2d97cf 100644 --- a/Lib/std/std_list.i +++ b/Lib/std/std_list.i @@ -106,8 +106,8 @@ namespace std { typedef _Tp* value_type; typedef value_type* pointer; typedef const value_type* const_pointer; - typedef value_type reference; - typedef value_type const_reference; + typedef value_type& reference; + typedef const value_type& const_reference; typedef _Alloc allocator_type; %traits_swigtype(_Tp);