To expand on that you could even do something like:

template<class T>
void auxDoSomething()
{}

template<>
void something<std::vector<double> >::doSomething()
{
  auxDoSomething<double>();
}

That way each of your specializations don't have to have code copied
and pasted into them....

Derek

On Jan 23, 2008 11:11 AM, Derek Gaston <[EMAIL PROTECTED]> wrote:
> Well... I made up a little toy code here... and got several other
> people from around the office (who are _very_ knowledgeable in C++
> lore) to come try and make it compile... with no luck.  It just
> doesn't seem to be possible.
>
> I _did_ actually get it to compile with something like this:
>
> template<>
> void something<std::vector<class T> >::doSomething()
> {}
>
> But it fails to link if actually try to instantiate one of those
> things... so the code isn't getting generated correctly.
>
> At this point my advice is this: how many things is std::complex going
> to be templated on?  I mean... really!??  Probably only just float,
> double, long double right?  In reality, probably just double.  My
> suggestion is just to do as you said earlier:
>
> template<>
> Real DistributedVector<std::complex<double> >::min () const {...}
>
> And if someone wants to use something besides double... then let them
> fill in the specialization....
>
> Derek
>
>
>
>
> On Jan 23, 2008 11:02 AM, Roy Stogner <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Wed, 23 Jan 2008, Derek Gaston wrote:
> >
> > > 2008/1/23 Roy Stogner <[EMAIL PROTECTED]>:
> > >> template<typename T>
> > >> Real DistributedVector<std::complex<T> >::min () const {...}
> > >
> > > Have you tried:
> > >
> > > template<typename T>
> > > Real DistributedVector<template std::complex<T> >::min () const {...}
> >
> > No; I didn't even know that was valid syntax.  Are you sure you don't
> > mean:
> >
> > template<typename T>
> > Real DistributedVector<typename std::complex<T> >::min () const {...}
> >
> > Adding "template" gives a bunch of "template argument 1 is invalid"
> > errors; adding "typename" gives the same "invalid use of undefined
> > type" errors.
> > ---
> > Roy
> >
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to