why parameter pack expansion is so limited?

前端 未结 1 995
梦如初夏
梦如初夏 2021-01-14 13:41

I was wondering, why parameter pack expansion is so limited in C++11 - is it just oversight in C++11 standard? Why is it not possible to do just bar(args)...;?

相关标签:
1条回答
  • 2021-01-14 14:27

    The reference mentions the different contexts in which parameter pack expansions are allowed. So, a slightly more succinct way of doing this is

    auto a = {bar(args)...};
    

    This won't work if the return type of bar is void.

    0 讨论(0)
提交回复
热议问题