24template <
class F,
class... Ts>
25void print(std::FILE* out,
const F& f, Ts&&... args)
35void print(std::FILE* out,
const F& f)
45template <
class F,
class... Ts>
46std::string
format(
const F& f, Ts&&... args)
49 size_t l = std::snprintf(
nullptr, 0, fmt,
formatForward(args)...);
55 return std::string(buf, buf + l);
57 std::vector<char> ptr(sz);
58 char* buf = ptr.data();
60 return std::string(buf, buf + l);
66inline std::string
operator*(
size_t k, std::string str)
68 std::ostringstream oss;
69 for (
size_t i = 0; i < k; ++i) {
77inline std::string
operator*(std::string str,
size_t k)
84inline std::string
operator""_s(
const char* s,
size_t len)
86 return std::string(s, len);
std::string format(const F &f, Ts &&... args)
Writes the formatted output to an std::string object.
Definition: ioprint.h:46
void print(std::FILE *out, const F &f, Ts &&... args)
Formatted output.
Definition: ioprint.h:25
__device__ real3 operator*(real a, real3 b)
Definition: realn.h:46
const T & formatForward(const T &t)
Definition: ioprint.h:8