Add in vectors of pointers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8068 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fa84803fbb
commit
b5acc30241
1 changed files with 23 additions and 4 deletions
|
|
@ -18,9 +18,13 @@ namespace std {
|
||||||
typedef float Real;
|
typedef float Real;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
/*
|
||||||
namespace std {
|
namespace std {
|
||||||
%template(RealVector) vector<Real>;
|
%template(RealVector) vector<Real>;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
// change back to above
|
||||||
|
%template(RealVector) std::vector<Real>;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
|
|
@ -46,13 +50,28 @@ struct Struct {
|
||||||
Struct(double d) : num(d) {}
|
Struct(double d) : num(d) {}
|
||||||
// bool operator==(const Struct &other) { return (num == other.num); }
|
// bool operator==(const Struct &other) { return (num == other.num); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::vector<Real> & vecreal(const std::vector<Real> & vec) { return vec; }
|
||||||
|
|
||||||
|
const std::vector<int> & vecintptr(const std::vector<int> & vec) { return vec; }
|
||||||
|
const std::vector<int *> & vecintptr(const std::vector<int *> & vec) { return vec; }
|
||||||
|
const std::vector<const int *> & vecintconstptr(const std::vector<const int *> & vec) { return vec; }
|
||||||
|
|
||||||
|
const std::vector<Struct> & vecstruct(const std::vector<Struct> & vec) { return vec; }
|
||||||
|
const std::vector<Struct *> & vecstructptr(const std::vector<Struct *> & vec) { return vec; }
|
||||||
|
const std::vector<const Struct *> & vecstructconstptr(const std::vector<const Struct *> & vec) { return vec; }
|
||||||
%}
|
%}
|
||||||
|
|
||||||
#ifndef SWIGCSHARP
|
#if defined(SWIGCSHARP)
|
||||||
// Can't do vectors of pointers yet
|
SWIG_STD_VECTOR_SPECIALIZE(Struct, Struct *)
|
||||||
%template(IntPtrVector) std::vector<int *>;
|
SWIG_STD_VECTOR_SPECIALIZE(Struct, const Struct *)
|
||||||
|
SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, int *)
|
||||||
|
SWIG_STD_VECTOR_SPECIALIZE(SWIGTYPE_p_int, const int *)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
%template(IntPtrVector) std::vector<int *>;
|
||||||
|
%template(IntConstPtrVector) std::vector<const int *>;
|
||||||
%template(StructVector) std::vector<Struct>;
|
%template(StructVector) std::vector<Struct>;
|
||||||
|
%template(StructPtrVector) std::vector<Struct *>;
|
||||||
|
%template(StructConstPtrVector) std::vector<const Struct *>;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue