Skip to content

Commit 583bcaf

Browse files
committed
Add nullary macro versions.
1 parent 9352bc5 commit 583bcaf

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ one, just define `ICECREAM_LONG_NAME` before the inclusion of `icecream.hpp` hea
476476
#include "icecream.hpp"
477477
```
478478

479+
While most compilers will work just fine, until the C++20 the standard requires at least
480+
one argument when calling a variadic macro. To handle this the nullary macros `IC0()` and
481+
`ICECREAM0()` are defined alongside `IC(...)` and `ICECREAM(...)`.
482+
479483
## Similar projects
480484

481485
The [CleanType](https://github.com/pthom/cleantype) library has a focus on printing

icecream.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@
5555

5656
#if defined(ICECREAM_LONG_NAME)
5757
#define ICECREAM(...) (::icecream::detail::Dispatcher{__FILE__, __LINE__, ICECREAM_FUNCTION, #__VA_ARGS__}).ret(__VA_ARGS__)
58+
#define ICECREAM0() (::icecream::detail::Dispatcher{__FILE__, __LINE__, ICECREAM_FUNCTION, ""}).ret()
5859
#else
5960
#define IC(...) (::icecream::detail::Dispatcher{__FILE__, __LINE__, ICECREAM_FUNCTION, #__VA_ARGS__}).ret(__VA_ARGS__)
61+
#define IC0() (::icecream::detail::Dispatcher{__FILE__, __LINE__, ICECREAM_FUNCTION, ""}).ret()
6062
#endif
6163

6264

0 commit comments

Comments
 (0)