Skip to content

converting std::queue to a native python type #3681

Answered by Skylion007
2bndy5 asked this question in Q&A
Discussion options

You must be logged in to vote

If you just want to cast a queue to a list, you can just add a typecaster or extend the typecaster in stl.h:

template <typename Type, typename Alloc> struct type_caster<std::deque<Type, Alloc>>

Interestingly, we have a caster for std::deque, but not std::queue. Apparently, stack and queue are usually implemented as restricted container adapters of deque. I suppose we should consider adding them:

template <typename Type, typename Alloc> struct type_caster<std::deque<Type, Alloc>>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@2bndy5
Comment options

@2bndy5
Comment options

Answer selected by 2bndy5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants