Seen on this site, the code shows macro invocations using a tilde in parentheses:
HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~))
// ^^^
What does it mean / do? I suspect it to just be an empty argument, but I’m not sure. Is it maybe specific to C(99) like the __VA_ARGS__ is specific to C99 and existent in C++?
On the introduction page of Boost.Preprocessor, an example is given in A.4.1.1 Horizontal Repetition
An explanation is provided below:
(emphasis mine)
And there is the note:
The tilde, therefore, is simply a place holder because an argument is required, but none is necessary. Since any user-defined identifier wannabe could be expanded, you need to use something else.
It turns out that
~is pretty much unused (binary negation is not that often called) in comparison to+or-for example, so there is little chance of confusion. Once you’ve settled on this, using it consistently gives it a new meaning to the tilde; like usingoperator<<andoperator>>for streaming data has become a C++ idiom.