Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
0.13.0
-
None
-
None
Description
Currently `writeBinary()` accepts only `std::string` as a container. While this is well suitable for many applications, it has the downside that its not easily possible to create a "shallow" for external memory. There is no constructor for `std::string` that would reference external memory, and no portable way to swap memory in or out of a `std::string`.
However it seems relatively straightforward to accept arbitrary containers in writeBinary(), i.e. something like
```
template<typename T>
writeBinary(T&& str) {
...
```
Of course this would require that these definitions are inlined.
Are there any problems with this approach? Would that be a suitable (acceptable) extension for Thrift?