19#ifndef itkPrintHelper_h
20#define itkPrintHelper_h
56operator<<(std::ostream & os,
const std::vector<T> & v);
60operator<<(std::ostream & os,
const std::list<T> & l);
62template <
typename T,
size_t VLength>
64operator<<(std::ostream & os,
const std::array<T, VLength> & container);
66template <
typename T,
size_t VLength,
typename = std::enable_if_t<!std::is_same_v<T,
char>>>
68operator<<(std::ostream & os,
const T (&arr)[VLength]);
100 os << indent << name <<
": ";
101 if constexpr (std::is_same_v<T, typename NumericTraits<T>::PrintType>)
107 os << static_cast<typename NumericTraits<T>::PrintType>(value);
114operator<<(std::ostream & os,
const std::vector<T> & v)
125 for (
auto it = v.begin(); it != std::prev(v.end()); ++it)
129 return os << v.back() <<
']';
134operator<<(std::ostream & os,
const std::list<T> & l)
142 for (
auto it = l.begin(); it != std::prev(l.end()); ++it)
146 return os << l.back() <<
']';
149template <
typename T,
size_t VLength>
151operator<<(std::ostream & os, [[maybe_unused]]
const std::array<T, VLength> & container)
153 if constexpr (VLength == 0)
160 for (
auto it = container.cbegin(); it != std::prev(container.cend()); ++it)
164 return os << container.back() <<
')';
169template <
typename T,
size_t VLength,
typename>
171operator<<(std::ostream & os,
const T (&arr)[VLength])
173 if constexpr (VLength == 0)
179 for (
size_t i = 0; i < VLength - 1; ++i)
181 os << arr[i] <<
", ";
183 return os << arr[VLength - 1] <<
')';
Control indentation during Print() invocation.
Define additional traits for native types such as int or float.
void PrintNumericTrait(std::ostream &os, const Indent &indent, const char *name, const T &value)
Print "<name>: <value>\n" indented, matching ITK's PrintSelf style.
std::ostream & operator<<(std::ostream &os, const std::vector< T > &v)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....