::std::initializer_list vs variadic templates

前端 未结 3 1775
傲寒
傲寒 2021-01-13 03:38

Does passing multiple arguments via ::std::initializer_list offer any advantages over the variadic function template method?

In code:

te         


        
3条回答
  •  心在旅途
    2021-01-13 04:26

    On occasions I had used variadic template functions just like yours, but then realized that I needed more parameters, possibly templated. In that case typename... A is too eager, and I was happy to rely on braces on the call site to clearly specify where the variadic list of arguments ends, and where the following optional arguments started.

提交回复
热议问题