cppx-core
Macros
macro-n_arguments.hpp File Reference

The $n_arguments macro evaluates to the number of arguments that are passed to it. More...

#include <cppx-core/meta-macro/macro-invoke_macro.hpp>
Include dependency graph for macro-n_arguments.hpp:

Go to the source code of this file.

Macros

#define n_arguments   CPPX_N_ARGUMENTS
 Real name: $n_arguments (the $ is just removed by Doxygen). More...
 
#define CPPX_N_ARGUMENTS(...)
 Evaluates to the number of arguments that are passed to it. More...
 

Detailed Description

The $n_arguments macro evaluates to the number of arguments that are passed to it.

It must be called with at least one argument, and at most 63 arguments. You can define CPPX_NO_DOLLARS_PLEASE to suppress the definition of the $n_arguments alias.

Definition in file macro-n_arguments.hpp.

Macro Definition Documentation

◆ CPPX_N_ARGUMENTS

#define CPPX_N_ARGUMENTS (   ...)

Evaluates to the number of arguments that are passed to it.

Must be called with at least one argument, and at most 63 arguments.

Based on original code by Laurent Deniau in a posting titled “__VA_NARG__”, 17 January 2006 in Usenet group “comp.std.c”.

In a response Roland Illig nooted that “using PP_NARG() without arguments would violate 6.10.3p4 of ISO C99.”, and this is so also for CPPX_N_ARGUMENTS in C++17; see §19.3/4.

Definition at line 27 of file macro-n_arguments.hpp.

◆ n_arguments

#define n_arguments   CPPX_N_ARGUMENTS

Real name: $n_arguments (the $ is just removed by Doxygen).

Definition at line 12 of file macro-n_arguments.hpp.