Search code examples
c++variadic-functionsdefault-parameters

Default arguments and variadic functions


Is there any way to specify a default parameter in a variadic function?(Applies to templates also)


Solution

  • In C++ you can replace the variadic function with one based on the Named Parameter Idiom.

    See the C++ FAQ item 10.20 What is the "Named Parameter Idiom"?.

    That gives you default functionality & convenient notation.

    Cheers & hth.,