1 Sep 2006 02:57
Re: Problems with %extending template classes
mark gossage <mark <at> gossage.cjb.net>
2006-09-01 00:57:24 GMT
2006-09-01 00:57:24 GMT
Hello Nitro,
> > On a differnt matter to the rest of the SWIG maintainers, it seems that
> > you can have to %extend the Vector<5>, it is not possible to %extend a
> > %template parameter, nor is it possible to %extend Vector<T>. Is
> this a bug?
>
> I am not a SWIG maintainer, but I have code like this in my interfaces and
> it works without a hitch:
>
> /** a simply array holding N values of type T
> */
> template<typename T, uint N>
> struct DCVector
> {
> T data[N]; ///< the components of the vector
>
> DCVECTOROPS(T,N)
>
> %extend
> {
> char* __str__() const
> {
> static DCString tmp="(";
>
> for (int i=0;i<N;i++)
> {
> tmp+=toString(self->data[i]);
> if (i!=N-1) tmp+=", ";
> }
(Continue reading)
RSS Feed