Giter Site home page Giter Site logo

Comments (14)

jpfeuffer avatar jpfeuffer commented on July 17, 2024

Hi,

can you add test files, add the test to e.g. test_code_generator and open a PR?

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

Does it work with more basic instantiation? E.g. # ScoreTypeRef := IteratorWrapper[A]

from autowrap.

poshul avatar poshul commented on July 17, 2024

It looks like it doesn't work with the more basic instantiation either. Looking at our existing codebase it looks like wrap-instances are only used locally, so it may be this issue has never come up.

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

ahh hmm that might also be the cause, yes. Can you check if it works locally in the same pxd file?

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

Is a cimport for ScoreTypeRef generated in the b.pxd file?

from autowrap.

poshul avatar poshul commented on July 17, 2024

It appears to not work even in the same pxd file (though it's necessarily in a different cdef extern from block on account of coming from different cpp files)

from autowrap.

poshul avatar poshul commented on July 17, 2024

Yup.

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

There is a similar test for this in autowrap already. There we just explicitly specify the instantiation again.

libcpp_vector[Templated[T]] passs(libcpp_vector[Templated[T]] v)

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

Probably only "cppclass"es can be put as template parameter. And the instantiation is already a cython "class".

from autowrap.

poshul avatar poshul commented on July 17, 2024

So at least in the triply nested case libcpp_vector[ IteratorWrapper [ libcpp_set [ ScoreType ] ] ] assigned_scores this fails.

from autowrap.

poshul avatar poshul commented on July 17, 2024

Probably only "cppclass"es can be put as template parameter. And the instantiation is already a cython "class".

libcpp_vector[ IteratorWrapper [ libcpp_set [ String ] ] ] assigned_scores also fails, so I think its probably how deeply nested these are allowed.

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

yes I can confirm.

self = <autowrap.Types.CppType object at 0x113478700>
typemap = {'T': <autowrap.Types.CppType object at 0x113703520>, 'T2': <autowrap.Types.CppType object at 0x113703910>, 'Templated': <autowrap.Types.CppType object at 0x113703040>, 'Templated_other': <autowrap.Types.CppType object at 0x113703700>, ...}
indent = 0

    def _transform(self, typemap, indent):
    
        aliased_t = typemap.get(self.base_type)
        if aliased_t is not None:
            if self.template_args is not None:
                if aliased_t.template_args is not None:
                    map_ = printable(typemap, "\n    ")
                    m = "invalid transform of %s with:\n    %s" % (self, map_)
>                   raise Exception(m)
E                   Exception: invalid transform of Templated[libcpp_vector[T]] with:
E                       T -> _T
E                       T2 -> _T2
E                       Templated -> _Templated[_T]
E                       Templated_other -> _Templated[_T2]
E                       Y -> _Y
E                       Z -> _Z

autowrap/Types.py:92: Exception

from autowrap.

jpfeuffer avatar jpfeuffer commented on July 17, 2024

What if you introduce (c)typedefs for now? Let me try

from autowrap.

poshul avatar poshul commented on July 17, 2024

What if you introduce (c)typedefs for now? Let me try

That at least gives us a more detailed error message:
Exception: Recursion in std::vector<T> is not implemented for other STL methods and wrapped template arguments

from autowrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.