1#ifndef LSST_GAUSS2D_TO_STRING_H
2#define LSST_GAUSS2D_TO_STRING_H
12namespace lsst::gauss2d {
15std::string to_string_float(
const T value,
const int precision = 6,
const bool scientific =
true) {
16 std::ostringstream out;
17 out.precision(precision);
19 out << std::scientific;
24 return std::move(out).str();
27template <
template <
typename...>
class Container,
class Value>
28std::string to_string_float_iter(
const Container<Value>& container,
const int precision = 6,
29 const bool scientific =
true) {
30 std::string str =
"[";
31 for (
const auto& value : container) {
32 str += to_string_float(value, precision, scientific) +
", ";
34 return str.substr(0, str.size() - 2 * (container.size() > 0)) +
"]";
37template <
template <
typename...>
class Container,
class Value>
38std::string to_string_iter(
const Container<Value>& container) {
39 std::string str =
"[";
40 for (
const auto& value : container) {
41 str += std::to_string(value) +
", ";
43 return str.substr(0, str.size() - 2 * (container.size() > 0)) +
"]";