/trunk/Examples/test-suite/template_int_const.i
Swig | 50 lines | 43 code | 7 blank | 0 comment | 0 complexity | 05225d5018d635e8a087d07fb2b7462e MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %module template_int_const
- %warnfilter(SWIGWARN_RUBY_WRONG_NAME) interface_traits; /* Ruby, wrong class name */
- %warnfilter(SWIGWARN_RUBY_WRONG_NAME) module_traits; /* Ruby, wrong class name */
- %inline %{
- enum Polarization { UnaryPolarization, BinaryPolarization };
- struct interface_traits
- {
- static const Polarization polarization = UnaryPolarization;
- };
- template <Polarization P>
- struct Interface_
- {
- };
-
- typedef unsigned int Category;
- struct module_traits
- {
- static const Category category = 1;
- };
-
- template <Category C>
- struct Module
- {
- };
- %}
-
- %template(Interface_UP) Interface_<UnaryPolarization>;
- %template(Module_1) Module<1>;
-
- %inline %{
- struct ExtInterface1 :
- Interface_<UnaryPolarization> // works
- {
- };
- struct ExtInterface2 :
- Interface_<interface_traits::polarization> // doesn't work
- {
- };
- struct ExtModule1 :
- Module<1> // works
- {
- };
- struct ExtModule2 :
- Module<module_traits::category> // doesn't work
- {
- };
- %}
-