C++ preprocessor __VA_ARGS__ number of arguments

后端 未结 12 2228
一向
一向 2020-11-22 08:03

Simple question for which I could not find answer on the net. In variadic argument macros, how to find the number of arguments? I am okay with boost preprocessor, if it has

12条回答
  •  [愿得一人]
    2020-11-22 08:36

    Boost Preprocessor actually has this as of Boost 1.49, as BOOST_PP_VARIADIC_SIZE(...). It works up to size 64.

    Under the hood, it's basically the same as Kornel Kisielewicz's answer.

提交回复
热议问题