54void print(std::ostream* out,
const T& arg) {
69template <
typename T,
typename... Targs>
70void print(std::ostream* out,
const char* fmt,
const T& value, Targs&&... Args) {
71 for (; *fmt !=
'\0'; fmt++) {
72 if (*fmt ==
'{' && *(fmt + 1) ==
'}') {
74 if (*(fmt + 1) !=
'\0') ++fmt;
75 print<>(out, fmt + 1, Args...);
90void println(std::ostream* out,
const T& arg) {
91 *out << arg << std::endl;
105template <
typename T,
typename... Targs>
106void println(std::ostream* out,
const char* fmt,
const T& value, Targs&&... Args) {
107 print<>(out, fmt, value, Args...);
119 print<>(&std::cout, arg);
132template <
typename T,
typename... Targs>
133void print(
const char* fmt,
const T& value, Targs&&... Args) {
134 print<>(&std::cout, fmt, value, Args...);
145 println<>(&std::cout, arg);
158template <
typename T,
typename... Targs>
159void println(
const char* fmt,
const T& value, Targs&&... Args) {
160 println<>(&std::cout, fmt, value, Args...);
172 std::ostringstream buf;
188template <
typename T,
typename... Targs>
189std::string
format(
const char* fmt,
const T& value, Targs&&... Args) {
190 std::ostringstream buf;
191 print<>(&buf, fmt, value, Args...);
Common definitions and utilities for the tec namespace.
std::string format(const T &arg)
Formats a single argument into a string.
Definition tec_print.hpp:171
void print(std::ostream *out, const T &arg)
Outputs a single argument to the specified stream.
Definition tec_print.hpp:54
void println(std::ostream *out, const T &arg)
Outputs a single argument to the specified stream with a newline.
Definition tec_print.hpp:90