From 049035ff3ec8152b74ebad640f6127b432434090 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 15 Aug 2012 22:36:15 +0000 Subject: [PATCH] Add discard and add methods to std::set and std::multiset wrappers so that pyabc.i can be used ensuring MutableSet is a valid abstract base class git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13619 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 5 +++++ Examples/test-suite/python/python_abstractbase_runme3.py | 8 ++++++++ Lib/python/std_set.i | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index eb109a6b0..651df4e2e 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,11 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.8 (in progress) =========================== +2012-08-15: wsfulton + [Python] Add discard and add methods to std::set wrappers so that pyabc.i can be used ensuring + MutableSet is a valid abstract base class for std::set. As reported by Alexey Sokolov. + Similarly for std::multiset. + 2012-08-15: wsfulton [Python] Fix #3541744 - Missing PyInt_FromSize_t calls for Python 3. diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme3.py index b7593f109..94dee3ff7 100644 --- a/Examples/test-suite/python/python_abstractbase_runme3.py +++ b/Examples/test-suite/python/python_abstractbase_runme3.py @@ -10,3 +10,11 @@ assert issubclass(IntSet, MutableSet) assert issubclass(IntMultiset, MutableSet) assert issubclass(IntVector, MutableSequence) assert issubclass(IntList, MutableSequence) + +mapii = Mapii() +multimapii = Multimapii() +intset = IntSet() +intmultiset = IntMultiset() +intvector = IntVector() +intlist = IntList() + diff --git a/Lib/python/std_set.i b/Lib/python/std_set.i index 59f69cdc9..53f97e475 100644 --- a/Lib/python/std_set.i +++ b/Lib/python/std_set.i @@ -49,6 +49,14 @@ return *(swig::cgetpos(self, i)); } + void add(value_type x) { + self->insert(x); + } + + void discard(value_type x) { + self->erase(x); + } + }; %enddef