diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2020-07-22 17:51:10 +0100 |
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2020-07-22 17:51:10 +0100 |
| commit | 6037847ea133c6faed0ff4bea023d72f5799d9e1 (patch) | |
| tree | 4153ae1af4b074b9bd3cd9a0d84fc2b429a909f3 /indra/test/print.h | |
| parent | a9ddf20ff2c704d30ec4b4d8652da0b0775b7631 (diff) | |
| parent | 72423372d6cd7f763a5567ad75752fa4e7131d60 (diff) | |
Merge remote-tracking branch 'origin/master' into SL-12995
Diffstat (limited to 'indra/test/print.h')
| -rw-r--r-- | indra/test/print.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/indra/test/print.h b/indra/test/print.h new file mode 100644 index 0000000000..08e36caddf --- /dev/null +++ b/indra/test/print.h @@ -0,0 +1,42 @@ +/** + * @file print.h + * @author Nat Goodspeed + * @date 2020-01-02 + * @brief print() function for debugging + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Copyright (c) 2020, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_PRINT_H) +#define LL_PRINT_H + +#include <iostream> + +// print(..., NONL); +// leaves the output dangling, suppressing the normally appended std::endl +struct NONL_t {}; +#define NONL (NONL_t()) + +// normal recursion end +inline +void print() +{ + std::cerr << std::endl; +} + +// print(NONL) is a no-op +inline +void print(NONL_t) +{ +} + +template <typename T, typename... ARGS> +void print(T&& first, ARGS&&... rest) +{ + std::cerr << first; + print(std::forward<ARGS>(rest)...); +} + +#endif /* ! defined(LL_PRINT_H) */ |
