blob: 749603907e6ed26dc34f7ca895850eb7cf07032c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/**
* @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()
{
#ifdef LL_TEST
std::cerr << std::endl;
#endif
}
// print(NONL) is a no-op
inline
void print(NONL_t)
{
}
template <typename T, typename... ARGS>
void print(T&& first, ARGS&&... rest)
{
#ifdef LL_TEST
std::cerr << first;
print(std::forward<ARGS>(rest)...);
#endif
}
#endif /* ! defined(LL_PRINT_H) */
|