<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>I am looking over your patch now.</div><div><br></div><div>I just had a comment on you code here... You have place the operator in the std namespace. Modifying the std namespace is not allowed, and can give warnings or error on some compilers.</div><div><br></div><div>These operators should be in the same namespace as the object. C++ should find the correct operator called from any namespace due to argument-dependent name lookup[1]. This is an advance C++ concept that many people don't know they are using, so I'd thought I'd just share the info.</div><div><br></div><div>Brad</div><div><br></div><div><br></div><div>[1] <a href="http://en.wikipedia.org/wiki/Argument-dependent_name_lookup">http://en.wikipedia.org/wiki/Argument-dependent_name_lookup</a></div><div><br><div><div>On Mar 21, 2014, at 2:38 PM, Taylor Braun-Jones <<a href="mailto:taylor@braun-jones.org">taylor@braun-jones.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><div dir="ltr">Hello Insight-users,<div><br></div><div>I'm trying to print an itk::LightObject-derived class with something like:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="courier new, monospace">MyClass::Pointer fooBar = MyClass::New();</font></div>
<div><font face="courier new, monospace">std::cout << *fooBar;</font></div></blockquote><div><br></div><div>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:</div>
<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="courier new, monospace">namespace std</font></div><div><div><font face="courier new, monospace">{</font></div>
</div><div><font face="courier new, monospace">ostream &</font></div><div><font face="courier new, monospace">operator<<(ostream & os, const itk::LightObject & o)</font></div><div>
<font face="courier new, monospace">{</font></div><div><font face="courier new, monospace">   o.Print(os);</font></div><div><font face="courier new, monospace">   return os;</font></div><div>
<font face="courier new, monospace">}</font></div><div><font face="courier new, monospace">}</font></div></blockquote><div><div><br></div><div>But is this the intended usage?</div><div><br></div><div>Thanks,</div>
<div>Taylor</div></div></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>