File size: 700 Bytes
d1be154 | 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 | #pragma once
#include <iostream>
#include <sstream>
#include <string>
namespace tf {
// Procedure: ostreamize
template <typename T>
void ostreamize(std::ostream& os, T&& token) {
os << std::forward<T>(token);
}
// Procedure: ostreamize
template <typename T, typename... Rest>
void ostreamize(std::ostream& os, T&& token, Rest&&... rest) {
os << std::forward<T>(token);
ostreamize(os, std::forward<Rest>(rest)...);
}
// Function: stringify
template <typename... ArgsT>
std::string stringify(ArgsT&&... args) {
std::ostringstream oss;
ostreamize(oss, std::forward<ArgsT>(args)...);
return oss.str();
}
} // end of namespace tf -----------------------------------------------------
|