#include <iostream>
#include <sstream>
#include <string>
using namespace std;
...
stringstream oss;string mystr;
oss << "Sample string";
mystr=oss.str();
It's up to you to translate this to Cython.
Gregor
What would this do even in C++? operator<< takes an std::ostream& as
its left argument, not a CppClass object.
What you might do is implement a method or function on the C++ side
that computes __repr__ as an std::string, in the usual fashion:
std::string repr(CppClass const &x)
{
std::ostringstream s;
return (s << x).str();
}
then call that from __repr__.
--
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam