You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Mario Emmenlauer (Jira)" <ji...@apache.org> on 2020/05/19 15:35:00 UTC
[jira] [Created] (THRIFT-5213) Could writeBinary() accept arbitrary
containers?
Mario Emmenlauer created THRIFT-5213:
----------------------------------------
Summary: Could writeBinary() accept arbitrary containers?
Key: THRIFT-5213
URL: https://issues.apache.org/jira/browse/THRIFT-5213
Project: Thrift
Issue Type: Improvement
Components: C++ - Compiler, C++ - Library
Affects Versions: 0.13.0
Reporter: Mario Emmenlauer
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?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)