Sorry to nitpick further, but I think we should use a `reinterpret_cast` here, rather than a C style cast:

```c++
  std::string return_string(reinterpret_cast<char *>(str));
```

See: http://stackoverflow.com/questions/1609163/what-is-the-difference-between-static-cast-and-c-style-casting