Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:34:44+00:00 2026-06-15T21:34:44+00:00

Why in Cython is possible to wrap std::pair<int, Foo*> myPair; but not std::pair<Foo*,Bar*> myPair;

  • 0

Why in Cython is possible to wrap

std::pair<int, Foo*> myPair;

but not

std::pair<Foo*,Bar*> myPair;

In particular, wrapping in Cython the std::pair is done as follows:

pair[int, Foo*]

and works smoothly, but when the first element of is also a pointer I have problems:

pair[Foo*,Bar*] myPair2

I’m getting

pair[Foo*,Bar*] myPair2
        ^
------------------------------------------------------------
test.pyx:50:17: Expected an identifier or literal

I’m using Cython 0.17.1, g++ 4.4 on Linux

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:34:45+00:00Added an answer on June 15, 2026 at 9:34 pm

    The types are treated the same in the pair definition; it is probably a general limitation for the [] syntax. You could try to workaround it with a typedef: ctypedef Foo* Foo_pointer

    Copy pasted from a comment by @J.F.Sebastian so that this question can be marked as answered (to hopefully clear up the list of unanswered questions — it has been a month!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What can be done in Cpython that can not be done in IronPython?
I have a function wrapped in Cython: cdef extern from myheader.h: int c_my_func (const_char
My goal is to use Cython to wrap the Apohenia library, a C library
Is it possible to integrate Cython and TG2? I have one computation (written in
Is it possible to import arbitrary modules in cython, compile them to shared object
I know it is possible to use Powershell from within IronPython, but is this
I'm not C expert so what I'm asking might be crazy. Is it possible
I am trying to write a Cython extension to CPython to wrap the mcrypt
I'd like to do exactly this in Cython: cdef int shiftIndexes[] = [1,-1, 0,
I'm trying call qsort in Cython with a custom compare function but I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.