[C++-sig] how do I instantiate templates in pyste with types defined in different files?

Scott McKay skottmckay at gmail.com
Fri Aug 12 21:01:22 CEST 2005


Include( "filename.h" )

On 8/12/05, Alexis H. Rivera-Rios <ahrivera at yahoo.com> wrote:
> Hi,
> 
> I'm trying to do something like the following.  Let
> say I have a file test.h that contains the following
> code:
> 
> template <class A, class B>
> class Test
> {
>    A a;
>    B b;
> };
> 
> Now I want to export an instanciate this template
> class using the types Astruct1, Astruct2 defined in
> atruct1.h and astruct2.h respectively.
> 
> In pyste, I write this:
> 
> Test = Template("Test","test.h")
> Test(["Astruct1","Astruct2","Test1")
> 
> When I try to compile this I get an error because the
> temporary file that is generated only includes test.h
> and it doens't now where the other types come from.
> What is the best way to handle this?
> 
> Is there a way to specify additional include files
> when I try to instantiate this code?  Or should I
> write code that does the appropriate instanciation and
> then export that?
> 
> Thanks,
> Alexis
> 
> 
> 
> 
> 
> Programming Tutorial:
> In Python: To do this, do this
> In Perl: To do this, do this or this or this or this...
> In C: To do this, do this, but be careful
> In C++: To do this, do this, but don't do this, be careful of this, watch out for this, and whatever you do, don't do this
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>



More information about the Cplusplus-sig mailing list