%module template_specialization %rename(__not__) *::operator!() const; #ifdef SWIGJAVA %rename(negate) *::operator-() const; #endif %inline %{ namespace vfncs { template struct UnaryFunction { UnaryFunction operator-() const { return *this; } }; template <> struct UnaryFunction { // This works // UnaryFunction operator!() const; // This doesn't UnaryFunction operator!() const { return *this; } // Does this? void foo(UnaryFunction) { } }; } %} namespace vfncs { %template(UnaryFunction_double) UnaryFunction; %template(UnaryFunction_bool) UnaryFunction; }