Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for C++11 alias template #3272

Open
McSinyx opened this issue Dec 16, 2019 · 0 comments
Open

Support for C++11 alias template #3272

McSinyx opened this issue Dec 16, 2019 · 0 comments

Comments

@McSinyx
Copy link

@McSinyx McSinyx commented Dec 16, 2019

I want to discuss on the support for the alias template, which was added to C++11.

Currently, the type alias (using identifier = type_id) is supported using the ctypedef type_id identiffier syntax, thanks to the semantic similarity between the two (one source I can find is subsection 2.1, proposal n1489). C++ attributes is not supported but it doesn't seem to have any meaning in Cython context anyway.

What is missing is an equivalent declaration for C++11's

template <template_parameter_list>
using identifier = type_id; 

which I propose to be ctypedef type_id = identifier[template_parameter_list] for consistency with the current C++ class and function template which are currently supported by Cython at the moment. For example, in <type_traits>,

template <class T>
using remove_reference_t = typename remove_reference<T>::type;

could be written in Cython as ctypedef remove_reference[T].type remove_reference_t[T].

I am unsure how this can be achieved.

This issue might be a part of #2130.

Edit: for extern declaration, would the following be sufficient?

cdef extern from '<type_traits>' namespace 'std' nogil:
    cdef cppclass remove_reference_t[T]:
        pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.