PageRenderTime 54ms CodeModel.GetById 1ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/test-suite/li_std_vector_ptr.i

#
Swig | 30 lines | 24 code | 6 blank | 0 comment | 0 complexity | a401c6c75d8e345569d2c8a9dce05b18 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // Bug 2359417
  2. %module li_std_vector_ptr
  3. %include "std_vector.i"
  4. %template(IntPtrVector) std::vector<int *>;
  5. %inline %{
  6. #include <iostream>
  7. using namespace std;
  8. int* makeIntPtr(int v) {
  9. return new int(v);
  10. }
  11. double* makeDoublePtr(double v) {
  12. return new double(v);
  13. }
  14. #if 1
  15. int** makeIntPtrPtr(int* v) {
  16. return new int*(v);
  17. }
  18. #endif
  19. void displayVector(std::vector<int *> vpi) {
  20. cout << "displayVector..." << endl;
  21. for (int i=0; i<vpi.size(); ++i)
  22. cout << *vpi[i] << endl;
  23. }
  24. %}