summaryrefslogtreecommitdiff
path: root/Lib/std/std_carray.swg
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2023-04-26 21:44:34 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2023-04-26 21:44:34 +0100
commit00d3b04b46e1b8a58fbf77fd377133fee816ae5a (patch)
tree21d1bb52989f1ab1da060717893462fdfa886f6a /Lib/std/std_carray.swg
parentca748cfe571fefad218b885894853ca1ade09377 (diff)
parent3a2318cb579edb3d1545210911b0058563521e3d (diff)
downloadswig-00d3b04b46e1b8a58fbf77fd377133fee816ae5a.tar.gz
Merge branch 'python-iterator-protocol'
* python-iterator-protocol: Finish removal of SwigPySequence_Cont Remove undocumented and non-existent STL std::carray Remove assign method uses by the removed Python Sequence Protocol Remove now redundant use of Python Sequence protocol in STL wrappers Add support for all STL containers to be constructible from a Python set Iterator Protocol support for std::array wrappers STL support for copying Python objects supporting Iterator protocol Closes #2515 Conflicts: CHANGES.current
Diffstat (limited to 'Lib/std/std_carray.swg')
-rw-r--r--Lib/std/std_carray.swg64
1 files changed, 0 insertions, 64 deletions
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];
- };
-}
-%}