6
%template(IntPair) pair<int, int>;
11
/* Test the "out" typemap for pair<T, U> */
12
std::pair<int, int> makeIntPair(int a, int b) {
13
return std::make_pair(a, b);
17
* There is no "out" typemap for a pointer to a pair, so
18
* this should return a wrapped instance of a std::pair
19
* instead of the native "array" type for the target language.
21
std::pair<int, int> * makeIntPairPtr(int a, int b) {
22
static std::pair<int, int> p = std::make_pair(a, b);
27
* There is no "out" typemap for a non-const reference to a pair, so
28
* this should return a wrapped instance of a std::pair instead of
29
* the native "array" type for the target language.
31
std::pair<int, int>& makeIntPairRef(int a, int b) {
32
static std::pair<int, int> p = std::make_pair(a, b);
37
* There is no "out" typemap for a const reference to a pair, so
38
* this should return a wrapped instance of a std::pair
39
* instead of the native "array" type for the target language.
41
const std::pair<int, int> & makeIntPairConstRef(int a, int b) {
42
static std::pair<int, int> p = std::make_pair(a, b);
46
/* Test the "in" typemap for pair<T, U> */
47
int product1(std::pair<int, int> p) {
48
return p.first*p.second;
51
/* Test the "in" typemap for const pair<T, U>& */
52
int product2(const std::pair<int, int>& p) {
53
return p.first*p.second;
56
/* Test the "in" typemap for const pair<T, U>* */
57
int product3(const std::pair<int, int> *p) {
58
return p->first*p->second;