Instantiation of C++11 variadic function templates

Complete support for C++11 variadic function templates. Support was previously limited
to just one template parameter. Now zero or more template parameters are supported
in the %template instantiation.
This commit is contained in:
William S Fulton 2023-01-03 22:34:59 +00:00
commit 2fc0edc4fd
5 changed files with 132 additions and 55 deletions

View file

@ -0,0 +1,20 @@
from cpp11_variadic_function_templates import *
ec = EmplaceContainer()
ec.emplace(A())
ec.emplace(A(), B())
ec.emplace(A(), B(), C())
ec.emplace(A(), B(), C(), D())
def check(expected, got):
if expected != got:
raise RuntimeError("failed: {} != {}".format(expected, got))
a = A()
b = B()
c = C()
check(variadicmix1(), 20)
check(variadicmix1(a), 20)
check(variadicmix1(a, b), 10)
check(variadicmix1(a, b, c), 20)
check(variadicmix1(11, 22), 10)