Well... I've found a workaround.  It turns out that I can just inject my own template specializations into the global namespace.... and they will get picked up by the compiler.  So I just made specializations for std::vector<Real> and std::vector<std::vector<Real> >.... and it works.

This way I don't have to modify libMesh.

Still wish I could figure out the proper syntax there though...


On Mon, Dec 22, 2008 at 4:39 PM, Derek Gaston <friedmud@gmail.com> wrote:
I've done similar things in the past... but that isn't working in this case.  In particular I get:

error: using 'typename' outside of template
error: 'T' was not declared in this scope



On Mon, Dec 22, 2008 at 2:55 PM, John Peterson <peterson@cfdlab.ae.utexas.edu> wrote:

Not sure if this is it but could you try:

void Parameters::Parameter<typename std::vector<T> >::print
(std::ostream& os) const

(just add the typename qualifier, everything else the same.)  Anyway,
that is what I always try when I'm dealing with templates and there is
a type which depends on T...


On Mon, Dec 22, 2008 at 2:38 PM, Derek Gaston <friedmud@gmail.com> wrote:
> Ok - I give up... someone tell me what the hell I'm doing wrong.  I'm trying
> to add the following function to parameters.h (right underneath the generic
> version):
> template <typename T>
> inline
> void Parameters::Parameter<std::vector<T> >::print (std::ostream& os) const
> {
>   for (unsigned int i=0; i<_value.size(); i++)
>     os << _value[i] << " ";
> }
> And I get errors:
> invalid use of undefined type 'class Parameters::Parameter<std::vector<T,
> std::allocator<_CharT> > >'
> /Users/gastdr/projects/libmesh/include/utils/parameters.h:163: error:
> declaration of 'class Parameters::Parameter<std::vector<T,
> std::allocator<_CharT> > >'
> /Users/gastdr/projects/libmesh/include/utils/parameters.h:260: error:
> template definition of non-template 'void
> Parameters::Parameter<std::vector<T, std::allocator<_CharT> >
>>::print(std::ostream&) const'
> /Users/gastdr/projects/libmesh/include/utils/parameters.h: In member
> function 'void Parameters::Parameter<std::vector<T, std::allocator<_CharT> >
>>::print(std::ostream&) const':
> But... if I do:
> template <>
> inline
> void Parameters::Parameter<std::vector<Real> >::print (std::ostream& os)
> const
> {
>   for (unsigned int i=0; i<_value.size(); i++)
>     os << _value[i] << " ";
> }
> Like normal template specialization.... it works fine.  I've tried looking
> this up in various places.... and from what I can see I'm doing it
> correctly.... so it's time for some outside advice.  I've also tried
> hundreds of permutations.... and just can't get the damn thing to go.
> Thanks!