[ITK Community] [Insight-users] Template question
Matt McCormick
matt.mccormick at kitware.com
Tue Jan 14 16:12:53 EST 2014
Hi Tim,
I am not sure the internals of XCode completion work, but something to
try is the use of explicit instantiation [1]. This can be created
with .cxx files with the instantiation line and adding the
preprocessor definition [2] ITK_MANUAL_INSTANIATION when building the
.cxx files.
Hope this helps,
Matt
[1] http://www.cplusplus.com/articles/1C75fSEw/
[2] http://cmake.org/cmake/help/v2.8.12/cmake.html#prop_tgt:COMPILE_DEFINITIONS
On Tue, Jan 14, 2014 at 12:12 PM, Tim Allman <dr.tim.allman at gmail.com> wrote:
> I'm writing to get some advice on C++ templates from some of the experts on
> this list.
>
> I want to write a class which is templated on the image type. There are many
> classes in ITK that are templated like this.
>
> template<typename TImage>
> class ImageProcessor { };
>
> The problem is that the class knows nothing about TImage until compile time
> and I would like to take advantage of the code assistance in Xcode as I
> write the class. This would require that the IDE know that TImage is really
> an ITK Image.
>
> This gets me closer
>
> template
> <
> template<typename TPixel, insigned Dimension> class TImage
>>
> class ImageProcessor { };
>
> but it still contains no information about itk::Image<TPixel, Dimension>
> beyond its signature.
>
> This gets me closer
>
> template<class TPixel, unsigned Dim>
> class ImageProcessor
> {
> public:
> typedef itk::Image<TPixel, Dim> ImageType;
> ...
> };
>
> but I'm curious to know if there is any way of getting the what I want.
>
> Thanks,
> Tim
>
>
> --
> Tim Allman, Ph.D.
> 35 Margaret Street,
> Guelph Ontario N1E 5R6
> Canada
>
>
> _____________________________________
> 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
>
_____________________________________
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