Extra Examples
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10790 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
719abc61cc
commit
ad0a3d9179
9 changed files with 63 additions and 16 deletions
|
|
@ -2,8 +2,15 @@
|
|||
|
||||
// Some template definitions
|
||||
|
||||
/*! Template class T
|
||||
\author cmfoil
|
||||
\sa something something */
|
||||
|
||||
template<class T> T max(T a, T b) { return a>b ? a : b; }
|
||||
|
||||
/*! Template class Vector
|
||||
\author cmfoil
|
||||
\sa something something */
|
||||
template<class T> class vector {
|
||||
T *v;
|
||||
int sz;
|
||||
|
|
@ -17,12 +24,12 @@ template<class T> class vector {
|
|||
}
|
||||
void set(int index, T &val) {
|
||||
v[index] = val;
|
||||
}
|
||||
} /*!< Something about set */
|
||||
#ifdef SWIG
|
||||
%extend {
|
||||
T getitem(int index) {
|
||||
return $self->get(index);
|
||||
}
|
||||
}/*!< Something about get item */
|
||||
void setitem(int index, T val) {
|
||||
$self->set(index,val);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue