The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
78
SWIG/Examples/test-suite/namespace_template.i
Normal file
78
SWIG/Examples/test-suite/namespace_template.i
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/* Tests the use of %template with namespaces */
|
||||
|
||||
%module namespace_template
|
||||
|
||||
%warnfilter(801) vector<int>; /* Ruby, wrong class name */
|
||||
%warnfilter(801) test2::vector<short>; /* Ruby, wrong class name */
|
||||
%warnfilter(801) test3::vector<long>; /* Ruby, wrong class name */
|
||||
%warnfilter(801) vector<test4::Integer>; /* Ruby, wrong class name */
|
||||
|
||||
%{
|
||||
namespace test {
|
||||
template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
|
||||
template<typename T> class vector {
|
||||
public:
|
||||
vector() { }
|
||||
~vector() { }
|
||||
char * blah(T x) {
|
||||
return (char *) "vector::blah";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace test2 {
|
||||
using namespace test;
|
||||
}
|
||||
|
||||
namespace test3 {
|
||||
using test::max;
|
||||
using test::vector;
|
||||
}
|
||||
|
||||
using namespace test2;
|
||||
namespace T4 = test;
|
||||
%}
|
||||
|
||||
namespace test {
|
||||
template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
|
||||
template<typename T> class vector {
|
||||
public:
|
||||
vector() { }
|
||||
~vector() { }
|
||||
char * blah(T x) {
|
||||
return (char *) "vector::blah";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
using namespace test;
|
||||
%template(maxint) max<int>;
|
||||
%template(vectorint) vector<int>;
|
||||
|
||||
namespace test2 {
|
||||
using namespace test;
|
||||
%template(maxshort) max<short>;
|
||||
%template(vectorshort) vector<short>;
|
||||
}
|
||||
|
||||
namespace test3 {
|
||||
using test::max;
|
||||
using test::vector;
|
||||
%template(maxlong) max<long>;
|
||||
%template(vectorlong) vector<long>;
|
||||
}
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace test4 {
|
||||
using namespace test;
|
||||
typedef int Integer;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
namespace test4 {
|
||||
%template(maxInteger) max<Integer>;
|
||||
%template(vectorInteger) vector<Integer>;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue