swig/Examples/test-suite/stl_no_default_constructor.i
Vadim Zeitlin 3dd96d5b95 Allow using vector with classes without default ctor in C too
This is similar to be491506a (Java std::vector improvements for types
that do not have a default constructor., 2019-03-01) for Java, except we
don't have to bother with any compatibility constraints for this, not
yet used by anyone. module.
2021-10-07 22:03:47 +02:00

19 lines
420 B
OpenEdge ABL

%module stl_no_default_constructor
%include <stl.i>
%inline %{
struct NoDefaultCtor {
int value;
NoDefaultCtor(int i) : value(i) {}
};
%}
#if defined(SWIGC) || defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGD)
%template(VectorNoDefaultCtor) std::vector<NoDefaultCtor>;
#endif
#if defined(SWIGJAVA) || defined(SWIGJAVA)
%include <std_list.i>
%template(ListNoDefaultCtor) std::list<NoDefaultCtor>;
#endif