~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Examples/test-suite/perl5/li_std_list.i

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%module li_std_list
2
 
 
3
 
%include "std_list.i"
4
 
 
5
 
%{
6
 
#include <algorithm>
7
 
#include <functional>
8
 
#include <numeric>
9
 
%}
10
 
 
11
 
namespace std {
12
 
    %template(IntList) list<int>;
13
 
}
14
 
 
15
 
%template(DoubleList) std::list<double>;
16
 
 
17
 
%inline %{
18
 
typedef float Real;
19
 
%}
20
 
 
21
 
namespace std {
22
 
    %template(RealList) list<Real>;
23
 
}
24
 
 
25
 
%inline %{
26
 
 
27
 
double average(std::list<int> v) {
28
 
    return std::accumulate(v.begin(),v.end(),0.0)/v.size();
29
 
}
30
 
 
31
 
 
32
 
void halve_in_place(std::list<double>& v) {
33
 
    std::transform(v.begin(),v.end(),v.begin(),
34
 
                   std::bind2nd(std::divides<double>(),2.0));
35
 
}
36
 
 
37
 
struct Struct {
38
 
  double num;
39
 
  Struct() : num(0.0) {}
40
 
  Struct(double d) : num(d) {}
41
 
//  bool operator==(const Struct &other) { return (num == other.num); }
42
 
};
43
 
%}
44
 
 
45
 
 
46