1 #ifndef NDARRAY_ABSL_ABSL_H 2 #define NDARRAY_ABSL_ABSL_H 4 #include "absl/strings/str_format.h" 5 #include "absl/strings/str_join.h" 15 template <
typename Sink, index_t Min, index_t Extent>
16 void AbslStringify(Sink& sink,
const interval<Min, Extent>& i) {
17 absl::Format(&sink,
"[%v, %v)", i.min(), i.min() + i.extent());
23 template <
typename Sink, index_t Min, index_t Extent, index_t Str
ide>
24 void AbslStringify(Sink& sink,
const dim<Min, Extent, Stride>& d) {
25 if (internal::is_resolved(d.stride())) {
26 absl::Format(&sink,
"dim(%v, %v, %v)", d.min(), d.extent(), d.stride());
28 absl::Format(&sink,
"dim(%v, %v)", d.min(), d.extent());
36 template <
typename Sink,
class... Dims>
37 void AbslStringify(Sink& sink,
const shape<Dims...>& sh) {
38 absl::Format(&sink,
"shape<%d>(%v)", sh.rank(), absl::StrJoin(sh.dims(),
", "));
43 #endif // NDARRAY_ABSL_ABSL_H Main header for array library.