diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2023-04-24 22:40:00 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2023-04-26 18:18:15 +0100 |
commit | 1835580589b34bb383218a3b8ca5bea1c535e084 (patch) | |
tree | 42b511fcad88b49a0fcff584d03d6152ff3bc29a | |
parent | 08aee96cbd1de0c842b29776be8c24e9f742ef2d (diff) | |
download | swig-1835580589b34bb383218a3b8ca5bea1c535e084.tar.gz |
Remove undocumented and non-existent STL std::carray
-rw-r--r-- | Examples/test-suite/li_std_carray.i | 8 | ||||
-rw-r--r-- | Examples/test-suite/octave/li_std_carray_runme.m | 52 | ||||
-rw-r--r-- | Examples/test-suite/python/Makefile.in | 1 | ||||
-rw-r--r-- | Examples/test-suite/python/li_std_carray_runme.py | 39 | ||||
-rw-r--r-- | Lib/octave/std_carray.i | 0 | ||||
-rw-r--r-- | Lib/python/std_carray.i | 54 | ||||
-rw-r--r-- | Lib/std/std_carray.swg | 64 |
7 files changed, 0 insertions, 218 deletions
diff --git a/Examples/test-suite/li_std_carray.i b/Examples/test-suite/li_std_carray.i deleted file mode 100644 index b38e0e441..000000000 --- a/Examples/test-suite/li_std_carray.i +++ /dev/null @@ -1,8 +0,0 @@ -%module li_std_carray - -%include <std_carray.i> - -%template(Vector3) std::carray<double, 3>; - -%template(Matrix3) std::carray<std::carray<double, 3>, 3>; - diff --git a/Examples/test-suite/octave/li_std_carray_runme.m b/Examples/test-suite/octave/li_std_carray_runme.m deleted file mode 100644 index f7212dc9a..000000000 --- a/Examples/test-suite/octave/li_std_carray_runme.m +++ /dev/null @@ -1,52 +0,0 @@ -li_std_carray - - -v3 = Vector3(); -for i=0:len(v3), - v3(i) = i; -endfor - -i = 0; -for d in v3, - if (d != i) - error("failed"); - endif - i = i + 1; -endfor - - -m3 = Matrix3(); - -for i=0:len(m3), - v3 = m3(i); - for j=0:len(v3), - v3(j) = i + j; - endfor -endfor - -i = 0; -for v3 in m3, - j = 0; - for d in v3, - if (d != i + j) - error("failed"); - endif - j = j + 1; - endfor - i = i + 1 -endfor - -for i=0:len(m3), - for j=0:len(m3), - if (m3(i,j) != i + j) - error("failed"); - endif - endfor -endfor - -da = Vector3([1,2,3]); -ma = Matrix3({[1,2,3],[4,5,6],[7,8,9]}); - - - - diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index baa89859a..46e23dbe5 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -73,7 +73,6 @@ CPP_TEST_CASES += \ swigobject \ template_matrix \ -# li_std_carray # director_profile CPP11_TEST_CASES = \ diff --git a/Examples/test-suite/python/li_std_carray_runme.py b/Examples/test-suite/python/li_std_carray_runme.py deleted file mode 100644 index 36eeaf173..000000000 --- a/Examples/test-suite/python/li_std_carray_runme.py +++ /dev/null @@ -1,39 +0,0 @@ -from li_std_carray import * - - -v3 = Vector3() -for i in range(0, len(v3)): - v3[i] = i - -i = 0 -for d in v3: - if d != i: - raise RuntimeError - i = i + 1 - - -m3 = Matrix3() - -for i in range(0, len(m3)): - v3 = m3[i] - for j in range(0, len(v3)): - v3[j] = i + j - -i = 0 -for v3 in m3: - j = 0 - for d in v3: - if d != i + j: - raise RuntimeError - j = j + 1 - pass - i = i + 1 - pass - -for i in range(0, len(m3)): - for j in range(0, len(m3)): - if m3[i][j] != i + j: - raise RuntimeError - -da = Vector3((1, 2, 3)) -ma = Matrix3(((1, 2, 3), (4, 5, 6), (7, 8, 9))) diff --git a/Lib/octave/std_carray.i b/Lib/octave/std_carray.i deleted file mode 100644 index e69de29bb..000000000 --- a/Lib/octave/std_carray.i +++ /dev/null diff --git a/Lib/python/std_carray.i b/Lib/python/std_carray.i deleted file mode 100644 index 680d67115..000000000 --- a/Lib/python/std_carray.i +++ /dev/null @@ -1,54 +0,0 @@ -%include <pycontainer.swg> - - -%fragment("StdCarrayTraits","header",fragment="StdSequenceTraits") -{ -namespace swig { - template <class T, size_t S> - struct traits_asptr<std::carray<T, S> > { - static int asptr(PyObject *obj, std::carray<T, S> **array) { - return traits_asptr_stdseq<std::carray<T, S> >::asptr(obj, array); - } - }; -} -} - -%warnfilter(SWIGWARN_IGNORE_OPERATOR_INDEX) std::carray::operator[]; - -%extend std::carray { - %fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header", - fragment="SwigPyIterator_T", - fragment=SWIG_Traits_frag(_Type), - fragment="StdCarrayTraits") { - namespace swig { - template <> struct traits<std::carray<_Type, _Size > > { - typedef pointer_category category; - static const char* type_name() { - return "std::carray<" #_Type "," #_Size " >"; - } - }; - } - } - - %typemaps_asptr(SWIG_TYPECHECK_VECTOR, swig::asptr, - SWIG_Traits_frag(std::carray<_Type, _Size >), - std::carray<_Type, _Size >); - - %typemap(out,noblock=1) iterator, const_iterator { - $result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - } - - inline size_t __len__() const { return self->size(); } - - inline const _Type& __getitem__(size_t i) const { return (*self)[i]; } - - inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; } - - - swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -} - -%include <std/std_carray.swg> diff --git a/Lib/std/std_carray.swg b/Lib/std/std_carray.swg deleted file mode 100644 index de2a07627..000000000 --- a/Lib/std/std_carray.swg +++ /dev/null @@ -1,64 +0,0 @@ -%{ -#include <algorithm> -%} - -// -// std::carray - is really an extension to the 'std' namespace. -// -// A simple fix C array wrapper, more or less as presented in -// -// "The C++ Standarf Library", by Nicolai M. Josuttis -// -// which is also derived from the example in -// -// "The C++ Programming Language", by Bjarne Stroustup. -// - -%inline %{ -namespace std { - template <class _Type, size_t _Size> - class carray - { - public: - typedef _Type value_type; - typedef size_t size_type; - - typedef _Type * iterator; - typedef const _Type * const_iterator; - - carray() { } - - carray(const carray& other) { - std::copy(other.v, other.v + size(), v); - } - - template <class _Iterator> - carray(_Iterator first, _Iterator last) { - assign(first, last); - } - - iterator begin() { return v; } - iterator end() { return v + _Size; } - - const_iterator begin() const { return v; } - const_iterator end() const { return v + _Size; } - - _Type& operator[](size_t i) { return v[i]; } - const _Type& operator[](size_t i) const { return v[i]; } - - static size_t size() { return _Size; } - - template <class _Iterator> - void assign(_Iterator first, _Iterator last) { - if (std::distance(first,last) == size()) { - std::copy(first, last, v); - } else { - throw std::length_error("bad range length"); - } - } - - private: - _Type v[_Size]; - }; -} -%} |