[ITK] [ITK-users] itk::LightObject does not expose operator<< in .h header

Taylor Braun-Jones taylor at braun-jones.org
Fri Mar 21 16:01:46 EDT 2014


Thanks, that would be great. Should I file a bug?

-- Taylor


On Fri, Mar 21, 2014 at 3:26 PM, Matt McCormick
<matt.mccormick at kitware.com>wrote:

> Hi Taylor,
>
> I think it would be reasonable to increase the visibility of that function.
>
> Thanks,
> Matt
>
> On Fri, Mar 21, 2014 at 2:38 PM, Taylor Braun-Jones
> <taylor at braun-jones.org> wrote:
> > Hello Insight-users,
> >
> > I'm trying to print an itk::LightObject-derived class with something
> like:
> >
> > MyClass::Pointer fooBar = MyClass::New();
> > std::cout << *fooBar;
> >
> >
> > But it doesn't seem to be possible because the declaration of operator<<
> is
> > not exposed in itkLightObject.h (although one is defined in
> > itkLightObject.cxx). I know I can use fooBar->Print(std::cout), but this
> > doesn't work when I'm trying to print to a logging system that was
> designed
> > to support any object with an overloaded operator<< defined. I am able to
> > get things to work by defining the operator myself:
> >
> > namespace std
> > {
> > ostream &
> > operator<<(ostream & os, const itk::LightObject & o)
> > {
> >    o.Print(os);
> >    return os;
> > }
> > }
> >
> >
> > But is this the intended usage?
> >
> > Thanks,
> > Taylor
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140321/28be7a2e/attachment-0002.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users


More information about the Community mailing list