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)

Reply via email to