forked from girving/mandelbrot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.h
24 lines (16 loc) · 772 Bytes
/
print.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Print formatted content with a newline
#pragma once
#include "format.h"
namespace mandelbrot {
using std::ostringstream;
// Also print output to given file
void tee(const string& path);
void print();
void print(const string& s);
void print_error(const string& s);
template<class T> string str(const T& x) { ostringstream s; s << x; return s.str(); }
template<class T> static inline void print(const T& x) { print(str(x)); }
template<class... Args> void print(const char* fmt, const Args&... args) { print(format(fmt, args...)); }
template<class T> static inline void print_error(const T& x) { print_error(str(x)); }
template<class... Args> void print_error(const char* fmt, const Args&... args) { print_error(format(fmt, args...)); }
} // namespace mandelbrot