[Insight-developers] templated members in VC++

Bill Hoffman bill.hoffman@kitware.com
Mon, 04 Dec 2000 16:06:51 -0500


They do not have to have the inline keyword, but have to be defined in the
class.

1. This is OK
template <class T>
class foo
{
   template<class R>
   void fun(R) {....}
};

2.  This is not.
template <class T>
class foo
{
   
};
template<class T>
template<class R>
void
foo<T>::fun(R v) {....}


However, I would not try this without a microsoft compiler handy to test it. 

  
At 02:57 PM 12/4/00 -0700, Joshua Cates wrote:
>Does this mean that only inline member functions can be templated?
>
>-Josh.
>
>
>On Mon, 4 Dec 2000, Bill Hoffman wrote:
>
> > As long as they are inside the class definition they should work.
> > It is partial specialization that is completely out.
> > For example, we are using template members in itkSmartPointer.h.
> > 
> > -Bill
> > 
> > 
> > At 01:54 PM 12/4/00 -0700, Joshua Cates wrote:
> > >Hello,
> > >
> > >Are we all in agreement that there is absolutely no way to template
> > >member functions in VC++?  I'm trying to redesign some of my code to work
> > >around this but it's not going to be pretty.
> > >
> > >Josh.
> > >
> > >+--+--+--+--+--+--+--+--+--+--+--+--
> > >  Josh Cates                     
> > >  Department of Computer Science 
> > >  University of Utah
> > >  Email: cates@cs.utah.edu
> > >  Phone: (801) 587-7697
> > >  URL:   www.cs.utk.edu/~cates
> > >--+--+--+--+--+--+--+--+--+--+--+---
> > >
> > >
> > >_______________________________________________
> > >Insight-developers mailing list
> > >Insight-developers@public.kitware.com
> > >http://public.kitware.com/mailman/listinfo/insight-developers 
> > 
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers