diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-08-11 20:41:46 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-08-11 20:41:46 +0300 |
commit | dde268cf852144eb641babf975a5905ca2c96a74 (patch) | |
tree | 6896b6ce31c25175adbf0b3131149c469d2093e0 /indra/test/print.h | |
parent | e1a3ce0d7465fd1c441168b0fcf5b849f47bab4e (diff) | |
parent | 89cde15fb8c52071805af78e61848e743f2ab2f1 (diff) |
Merge branch 'master' into DRTVWR-483
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) */ |