x squared
x squared

Reputation: 3354

How to use C++ std functions in Cython?

I would like to write a Cython function that involves strings, so of course I am inclined to use libcpp.string. But I could not figure out how to import std functions like std::to_string().

What is the cleanest way to make std functions available to my Cython file?

Upvotes: 0

Views: 642

Answers (1)

user5357122
user5357122

Reputation: 36

A wrapper needs to be written. A full tutorial can be found on docs.cython.org. Some of the standard library has already been ported, but given the monumental effort needed to complete a task (and then do C++11), I highly doubt you'll see std::to_string any time soon.

Anyways, just write it yourself. std::to_string is just a wrapper over std::sprintf anyway.

Upvotes: 2

Related Questions