PrintSelf() for use in debugger

Please consider adding an overload to ::PrintSelf() which defaults to one of the standard output streams and does not require an ostream reference. As far as I can tell [1, 2], the current signature

PrintSelf (std::ostream &os, Indent indent) const

cannot be called from a debugger because it is not possible to get a reference to any std ostream (at least not in lldb, which is de facto the only debugger these days on macOS). In some situations, the debugger’s pretty-printer is not sufficient (or sometimes broken due to failed lookup of elided symbols).

If this is acceptable, I could make the appropriate MR.

Hi Isaiah,

A patch to add a default for std::cout would be welcome. However, it should probably go on Print() instead of PrintSelf() because this is the public method intended to be called on an instance to display its state.


For your debugger does having an overloaded operator<< help?

You could add something like:

namespace itk

ostream& operator<<(ostream& os, const LightObject &obj ) ;