fix feautures + qual + templates
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6578 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f4646cc5a0
commit
d6e3a92182
2 changed files with 89 additions and 21 deletions
|
|
@ -68,3 +68,60 @@ public:
|
|||
|
||||
%template(TemplateInt) Template<int>;
|
||||
|
||||
|
||||
%newobject One::getSquare() const;
|
||||
|
||||
%inline %{
|
||||
|
||||
struct Square
|
||||
{
|
||||
Square(int)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct One {
|
||||
Square *getSquare() const { return new Square(10); }
|
||||
};
|
||||
%}
|
||||
|
||||
%newobject Two::getSquare();
|
||||
|
||||
%inline %{
|
||||
struct Two {
|
||||
Square *getSquare() const { return new Square(10); }
|
||||
};
|
||||
|
||||
char *foo() {return 0;}
|
||||
|
||||
%}
|
||||
|
||||
|
||||
%exception {
|
||||
// default %exception
|
||||
}
|
||||
|
||||
%exception std::Vector::get {
|
||||
// get %exception
|
||||
}
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class Vector {
|
||||
public:
|
||||
void push_back(const T& x) {}
|
||||
#ifdef SWIG
|
||||
%extend {
|
||||
T& get(int i) {
|
||||
throw std::out_of_range("Vector index out of range");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%template(VectorInt) std::Vector<int>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue