PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Swig | 60 lines | 39 code | 17 blank | 4 comment | 0 complexity | 3b3fb938af3d9f14c6f76607a55c5492 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module abstract_typedef2
  2. /*
  3. After the fix for abstract_typedef, this simpler
  4. example got broken.
  5. */
  6. %inline %{
  7. enum FieldDim {
  8. UnaryField,
  9. BinaryField
  10. };
  11. template <FieldDim Dim>
  12. struct Facet;
  13. template <FieldDim Dim>
  14. struct Base
  15. {
  16. virtual ~Base() {}
  17. typedef unsigned int size_type;
  18. typedef Facet<Dim>* facet_ptr;
  19. // This works
  20. // virtual Facet<Dim>* set(size_type) = 0;
  21. // This doesn't
  22. virtual facet_ptr set(size_type) = 0;
  23. };
  24. template <FieldDim Dim>
  25. struct Facet
  26. {
  27. };
  28. template <FieldDim Dim>
  29. struct A : Base<Dim>
  30. {
  31. typedef Base<Dim> base;
  32. typedef typename base::size_type size_type;
  33. A(int a = 0)
  34. {
  35. }
  36. Facet<Dim>* set(size_type)
  37. {
  38. return 0;
  39. }
  40. };
  41. %}
  42. %template(Base_UF) Base<UnaryField>;
  43. %template(A_UF) A<UnaryField>;