From f635981d2ff6c776552ceef28497cd0ef2e067b0 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 20 Oct 2004 21:04:01 +0000 Subject: [PATCH] default args in templated function in a namespace tests added git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6452 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/template_default_arg.i | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/SWIG/Examples/test-suite/template_default_arg.i b/SWIG/Examples/test-suite/template_default_arg.i index 73e014f41..2bb264605 100644 --- a/SWIG/Examples/test-suite/template_default_arg.i +++ b/SWIG/Examples/test-suite/template_default_arg.i @@ -95,3 +95,26 @@ %template(ottint) ott; // default arg requires a rename %template(ottstring) ott; // default arg requires a rename + +// Above test in namespaces +%inline %{ +namespace OuterSpace { + namespace InnerSpace { + // Templated methods which are overloaded and have default args, and %template which + // uses the same name as the C++ functions and overload on the template parameters and + // specialization thrown in too. Wow, SWIG can handle this insane stuff! + template int nsott(T t = 0, const U& u = U()) { return 110; } + template int nsott(const char *msg, T t = 0, const U& u = U()) { return 120; } + int nsott(Foo) { return 130; } + template int nsott(Hello h, T t = 0) { return 140; } + template<> int nsott(Hello h, int t) { return 150; } + template<> int nsott(Hello h, double t) { return 160; } + } +} +%} + +%template(nsott) OuterSpace::InnerSpace::nsott; +%template(nsott) OuterSpace::InnerSpace::nsott; +%template(nsottint) OuterSpace::InnerSpace::nsott; // default arg requires a rename +%template(nsottstring) OuterSpace::InnerSpace::nsott; // default arg requires a rename +