[ITK-users] Smartpointer as a default parameter for a function

vincent ngai vincent.ngai at gmail.com
Tue Jul 22 04:49:02 EDT 2014


Technically it should be A(int a, ImageType::Pointer ptr =
ImageType::Pointer() );

But I"m not sure if parameter defaults are supported on non-POD parameter
types. Why not just overload the ctor and create another
class A
{
 A(int a, ImageType::Pointer ptr);
 A( int a );
};


On Tue, Jul 22, 2014 at 3:37 PM, <ahmed at mufradat.com> wrote:

> Hello All,
>
> Suppose I have class like
>
> class A{
>     public:
>     A(int a, ImageType::Pointer ptr){
>         // whatever!
>     }
> };
>
> My question is, what's the default value for that ptr? I'd like to be able
> to create an instance of that class using
>
> A myA(5);
>
> so for the definition of the constructor of A:
>
> A(int a, ImageType::Pointer ptr = WHAT?)
>
> Best regards,
> Ahmed
> _____________________________________
> 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://public.kitware.com/mailman/listinfo/insight-users
>



-- 
Regards,
Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20140722/1ea1b985/attachment.html>


More information about the Insight-users mailing list