diff --git a/SWIG/Examples/test-suite/preproc.i b/SWIG/Examples/test-suite/preproc.i index 34a08518a..03789cb87 100644 --- a/SWIG/Examples/test-suite/preproc.i +++ b/SWIG/Examples/test-suite/preproc.i @@ -204,4 +204,20 @@ This testcase tests operators for defines +#ifdef __cplusplus + +#define %mangle(...) #@__VA_ARGS__ +#define %mangle_str(...) ##@__VA_ARGS__ +%define my_func(...) +inline const char* mangle ## #@__VA_ARGS__ () { + return %mangle_str(__VA_ARGS__); +} +%enddef + +%inline { + my_func(class Int) ; + my_func(std::pair >*) ; +} + +#endif diff --git a/SWIG/Examples/test-suite/python/complextest.i b/SWIG/Examples/test-suite/python/complextest.i index 1e5afb6c2..03ad5aebf 100644 --- a/SWIG/Examples/test-suite/python/complextest.i +++ b/SWIG/Examples/test-suite/python/complextest.i @@ -3,6 +3,16 @@ %include #ifdef __cplusplus +%{ +#include +#include +#include +%} +%include + +#if 1 +%template(VectorStdCplx) std::vector >; +#endif %inline { @@ -15,8 +25,18 @@ { return std::conj(a); } + +#if 1 + std::vector > Copy_h(const std::vector >& a) + { + std::vector > b(a.size()/2); + std::copy(a.begin(), a.begin()+a.size()/2, b.begin()); + return b; + } +#endif } + #else %inline diff --git a/SWIG/Examples/test-suite/template_ns.i b/SWIG/Examples/test-suite/template_ns.i index 90af05fac..bd0bf643f 100644 --- a/SWIG/Examples/test-suite/template_ns.i +++ b/SWIG/Examples/test-suite/template_ns.i @@ -3,33 +3,33 @@ %module template_ns -%warnfilter(801) std::pair; /* Ruby, wrong class name */ -%warnfilter(801) std::pair; /* Ruby, wrong class name */ +%warnfilter(801) std::my_pair; /* Ruby, wrong class name */ +%warnfilter(801) std::my_pair; /* Ruby, wrong class name */ -%ignore std::pair::pair(); +%ignore std::my_pair::my_pair(); %inline %{ namespace std { template -struct pair { +struct my_pair { typedef _T1 first_type; typedef _T2 second_type; _T1 first; _T2 second; - pair() : first(_T1()), second(_T2()) {} - pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} + my_pair() : first(_T1()), second(_T2()) {} + my_pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} template - pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} + my_pair(const my_pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} }; } %} // Add copy constructor -%extend std::pair { - %template(pair) pair<_T1,_T2>; +%extend std::my_pair { + %template(pair) my_pair<_T1,_T2>; }; -%template(pairii) std::pair; -%template(pairdd) std::pair; +%template(pairii) std::my_pair; +%template(pairdd) std::my_pair;