std::pair as container value_type

Asked by Sebastian Luther

I'm trying to wrap a function that looks like this:

std::list<std::pair<X,Y> > f();

I tried:
mod.add_class('std::pair', template_parameters=['X', 'Y'])
mod.add_container('std::list<std::pair<X,Y> >', 'std::pair<X,Y>', 'list')
pybindgen.typehandlers.base.TypeLookupError: ['std::pair<X,Y>']

What's the correct way to do this?

Question information

Language:
English Edit question
Status:
Solved
For:
PyBindGen Edit question
Assignee:
No assignee Edit question
Solved by:
Sebastian Luther
Solved:
Last query:
Last reply:
Revision history for this message
Gustavo Carneiro (gjc) said :
#1

Well, from memory, this is not correct:

mod.add_class('std::pair', template_parameters=['X', 'Y'])

Instead try:

pair = mod.add_class('pair', template_parameters=['X', 'Y'], foreign_cpp_namespace='std')
... now add constructor and attributes to pair ...

Revision history for this message
Sebastian Luther (sebastianluther) said :
#2

This works. Thank you!