Afficher un message
Vieux 16/10/2007, 02h15   #2
er
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: hiding non template dependent implementation in a template class

On Oct 15, 6:09 pm, er <erwann.rog...@gmail.com> wrote:
> hi,
>
> suppose i have
> a)
> template<typename T>
> class B{
> A*
> public:
> /* depends on T*/
>
> };
>
> or
>
> b)
> class B{
> A*
> public:
> template<typename T>
> double f(T&); /* impl depends on T */
>
> };
>
> -if the template was not there i would only need to declare A in the
> header of B and #include "A.h" in its source file.
> - with the inclusion model (declaration & definitions included in a
> common hpp) for templates, i obviously cannot do this.
> - for b) i did not run into problem with a toy problem (as above) by
> keeping the definitions of B::f(T&) in the header, and every other
> definition in the cpp file.
> -but for a more complex class, for b) i did run into problem "invalid
> use of undefined struct `A"class.
>
> before i start looking into the explicit and separation models (i
> remember running into problems with export with g++) -if at all useful
> in this case- could someone please offer a little of guidance on this
> issue?


ps: i guess i could replace A* by

class A_wrap{
A*;
};

?

  Réponse avec citation
 
Page generated in 0,05531 seconds with 9 queries