commit a6c2305a8196cb8bb7edf8d369e3052c0ef82fb2
parent b447a243d97154eb10dd8b14e7087b2bebee1b0e
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date: Mon, 22 Jan 2024 07:30:09 +0000
array_to_string: use Fmt
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/kfr/cometa/string.hpp b/include/kfr/cometa/string.hpp
@@ -654,7 +654,7 @@ std::string array_to_string(size_t size, Getter&& getter, int max_columns = 16,
std::string_view separator = ", ", std::string_view open = "{",
std::string_view close = "}")
{
- return array_to_string(std::array<size_t, 1>{ size }, std::forward<Getter>(getter), max_columns,
+ return array_to_string<Fmt>(std::array<size_t, 1>{ size }, std::forward<Getter>(getter), max_columns,
max_dimensions, std::move(separator), std::move(open), std::move(close));
}
template <typename Fmt = void, typename T>
@@ -662,7 +662,7 @@ std::string array_to_string(size_t size, T* data, int max_columns = 16, int max_
std::string_view separator = ", ", std::string_view open = "{",
std::string_view close = "}")
{
- return array_to_string(
+ return array_to_string<Fmt>(
std::array<size_t, 1>{ size }, [data](std::array<size_t, 1> i) { return data[i.front()]; },
max_columns, max_dimensions, std::move(separator), std::move(open), std::move(close));
}
diff --git a/tests/unit/base/tensor.cpp b/tests/unit/base/tensor.cpp
@@ -401,7 +401,7 @@ TEST(tensor_tostring)
t0(0) = vec{ 1, 2 };
t0(1) = vec{ 3, 4 };
t0(2) = vec{ -1, 1000 };
- CHECK(t0.to_string<fmt_t<f32x2, 'f', 0, 2>>() == "{{1, 2}, {3, 4}, {-1, 1000}}");
+ CHECK(t0.to_string<fmt_t<f32x2, 'f', 0, 0>>() == "{{1, 2}, {3, 4}, {-1, 1000}}");
tensor<float, 1> t1(shape<1>{ 60 });
t1 = debug_counter<float, 1>();